Skip to content

Add recognize and recognizeAndLoad#261

Merged
chadhietala merged 2 commits intomasterfrom
add-missing-apis
Oct 3, 2018
Merged

Add recognize and recognizeAndLoad#261
chadhietala merged 2 commits intomasterfrom
add-missing-apis

Conversation

@chadhietala
Copy link
Contributor

This adds 2 new APIs that were defined in emberjs/rfcs#95.

  • recognize: Takes a string URL and returns a RouteInfo for the leafmost route represented by the URL. Returns null if the URL is not recognized. This method expects to receive the actual URL as seen by the browser including the app's rootURL.

  • recognizeAndLoad: Takes a string URL and returns a promise that resolves to a RouteInfoWithAttributes for the leafmost route represented by the URL. The promise rejects if the URL is not recognized or an unhandled exception is encountered. This method expects to receive the actual URL as seen by the browser including the app's rootURL.

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any tests specifically showing the interaction with the rootURL for recognizeAndLoad / recognize?

let { name, params, paramNames } = info;
let publicRouteInfo = new class implements RouteInfo {
let { name, params, paramNames, context } = info;
let RoutInfoImpl = class RoutInfoImpl {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually need a class here? Seems like we could just use a POJO...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I do Object.assign is it going to get re-written to something in Ember?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@chadhietala
Copy link
Contributor Author

I just copy and pasted these definitions from the RFC. rootURL is an Ember thing and not a router.js thing. I suspect that we need to triage this in integration on the Ember side.

@chadhietala chadhietala merged commit 5c99b38 into master Oct 3, 2018
@chadhietala chadhietala deleted the add-missing-apis branch October 3, 2018 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants