Batman.js is no longer in production at Shopify and is not actively maintained.

This website is left for reference (and for old times' sake).


Batman.Navigator is an abstract class which maps URLs and Batman.Dispatcher actions. Batman.js provides two implementations out of the box: Batman.PushStateNavigator (default) and Batman.HashbangNavigator (enabled by a configuration setting).

It's uncommon to interact with a Navigator directly. Under the hood, each Batman.App has a Navigator at MyApp.navigator which is used for dispatching actions. This navigator is also set to Batman.navigator. Other uses include:

  • Batman.Navigator.normalizePath is frequently used to join path segments
  • MyApp.navigator.linkTo is used by data-route bindings
  • Batman.redirect delegates to MyApp.navigator.redirect

Batman.Navigator does not extend Batman.Object so it is not observable and does not respond to get, set, or @accessor.

Help us improve our documentation!

Contributions to this page are welcome on Github. If you find a problem but you cannot fix it, please open an issue.

Discussion regarding batman.js documentation is also welcome on our mailing list.