The Router API is getting a facelift very shortly. Most of the work is done already, but I wanted to give everyone a chance to give it a try before settling in on the final API.
In short, the existing router API is awesome, but lacks in the async department; if your app needs any sort of logic, sync or async, to be performed before a transition takes to determine whether the transition should take place, you don’t have a lot of options, and at the very least, your code will suffer, and in many cases, what you’re after literally cannot be done way that yields a satisfying user experience.
handleURL(internal method for URL transitions) are async and return Promises that resolve/reject if the transition succeeds/redirects, respectively.
Ember.Routeis getting some new transition validation hooks that get called before the route’s actually entered.
At the time of writing, both the
Ember code is finished and is passing test cases, so I’d love it if everyone could give the code at the Ember code a try. There’s also a more in-depth description of the API in this gist, complete with a lot of live JSBin demos of cool stuff you can do with this API that couldn’t be (easily) done before.
This change probably won’t go into the next release candidate, but definitely will go in before 1.0, so I’d really like to make sure we do this thing right. Please have a look at the API and maybe get started toying with the examples in the above gist.
- Do the validation hooks have proper names?
- How easy is it to grok this stuff?
- What could be made easier?
- How do you like the approaches to the solving the example problems?