flatiron / director

a tiny and isomorphic URL router for JavaScript
http://github.com/flatiron/director
MIT License
5.61k stars 483 forks source link

Can't have a route run on all pages #190

Open OscarGodson opened 11 years ago

OscarGodson commented 11 years ago

Example: https://github.com/OscarGodson/todomvc/blob/5666d87f4ec7671008d01e7c426fce80b0faeff2/vanilla-examples/vanillajs/js/controller.js#L33-L38

I would have liked to do a * and it would have run on all pages. Problem is that it overwrites other handlers.

Like this:

router.on('*', function () {
  this._updateFilterState();
});
beaugunderson commented 10 years ago

You can specify an on member of the object passed to Router.configure that will run on all routes.

It would be fantastic if multiple route handlers that matched the same string would each run, though!