Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recognize and recognizeAndLoad #261

Merged
merged 2 commits into from Oct 3, 2018
Merged

Add recognize and recognizeAndLoad #261

merged 2 commits into from Oct 3, 2018

Conversation

chadhietala
Copy link
Collaborator

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
Collaborator

@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
Collaborator

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
Collaborator 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
Collaborator

Choose a reason for hiding this comment

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

Yes

@chadhietala
Copy link
Collaborator 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.

None yet

2 participants