Hi all,
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.
Here are the relevant Pull Requests for the router.js microlib and Ember.js.
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.
In short:
-
transitionTo
andhandleURL
(internal method for URL transitions) are async and return Promises that resolve/reject if the transition succeeds/redirects, respectively. -
Ember.Route
is getting some new transition validation hooks that get called before the routeās actually entered.
At the time of writing, both the router.js
and 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.
Lemme know:
- 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?