Aviator v0.4.0 released
We have fixed a bunch of minor bugs since 0.3.0, but a few nice features also snuck in, including...
Aviator.navigate protects against possible races
If an action in the action chain ever calls Aviator.navigate
all subsequent action invocations for the current url will be cancelled, eliminating race conditions.
Simple, code-free route redirect
Use Aviator.rewriteRouteTo
to redirect directly from your route definitions:
Aviator.setRoute({
'/foo': Aviator.rewriteRouteTo('/baz/:bar/foo'),
'/baz': {
'/:bar': {
target: fooBarTarget,
'/foo':'foo'
}
}
});
Multiple slashes per route level
It’s now possible to add route levels with multiple slashes, including namedParams:
Aviator.setRoutes({
'/admin/users/:id': {
target: usersTarget,
'/': 'show',
'/edit':'edit'
}
});
Better defaults to DRY up Aviator.setRoutes
It’s now possible to add a route level without a target, and the nearest ancestral target will be used:
Aviator.setRoutes({
'/users': {
target: usersTarget,
'/': 'index',
'/:id': {
'/': 'show',
'/edit': 'edit'
}
}
});
In the above example usersTarget#show
will be called on urls: '/users/12' and usersTarget#edit
on '/users/12/edit'
Changelog
- Fix “back to initial page” bug
- Fix encode/decode of URI parts
- Halt action invocation on
navigate
calls - Add support for 'exits'
- Add
rewriteRouteTo
- Add support for multiple slashes per route level
- Add support of ancestor route targets