-
Notifications
You must be signed in to change notification settings - Fork 159
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
transitionTo and handleURL fail silently if triggerEvent
is not provided.
#333
Comments
I've found another undocumented function: Am I missing something? It seems this project was not meant to be used outside of Ember? |
After a lot of headbashing, I found some code in the Unit Tests which should be explained in the Readme. The Router class provided is not ready to use, you need to extend the class with your own concrete Router class which implements vital functionality. Especially the event handling code which should at least be provided by default. For anyone stuck on this issue, this is how to properly subclass the Router and provide yourself with a working instance:
|
I ran into this too. router.triggerEvent = (handlerInfos, ignoreFailure, name, args) => {}
router.routeWillChange = (newTransition) => {};
router.willTransition = (oldRouteInfos, routeInfos, newTransition) => {};
router.routeDidChange = (newTransition) => {};
router.didTransition = (routeInfos) => {
let {name, params} = routeInfos[0];
handlers[name].model(params);
}; |
If you create a new Router() instance and do not create a
triggerEvent
function on it (eg.router.triggerEvent = function(){};
) then when you try to use the router viatransitionTo
orhandleURL
your route handler functions will not be called, the hidden optional logging function provided as a constructor argument doesnt log any errors, nor does the javascript engine itself. Only the returned Intent object shows athis.triggerEvent is not a function
error without any additional information.Doing a global text search through the entire codebase for "triggerEvent" only returns a function definition in
router.d.ts
which implies that the function should be implemented inside therouter.es.js
module but it isnt.Also reading through the entire README yields no mention of
triggerEvent
or anything to point towards an issue here.The text was updated successfully, but these errors were encountered: