Plugins
router5 is extensible with the use of plugins. Plugins can decorate a route instance and do things on specific router and transition events.
Plugin requirements
A plugin is a function taking a router instance and returning an object with a name and at least one of the following methods:
onStart()
: invoked whenrouter.start()
is calledonStop()
: invoked whenrouter.stop()
is calledonTransitionStart(toState, fromState)
onTransitionCancel(toState, fromState)
onTransitionError(toState, fromState, err)
onTransitionSuccess(toState, fromState, opts)
(options containsreplace
andreload
boolean flags)teardown()
: a function called when removing the plugin
Registering a plugin
Plugin examples
Router5 includes a logging plugin that you can use to help development
Last updated