router5 link interceptor
Link interceptor plugin for router5.
Install
npm install --save router5-link-interceptor
API
router;
Register a plugin to intercept all click events of links and call the Router5 navigate method. Query string of the link will be parsed into routeParams
.
Arguments
opts
(Object or Function): Theopts
argument of Router5 navigate method. If you pass a Function, it will be called withfn(routeName, routeParams)
.[callback]
(Function): Thecallback
argument of Router5 navigate method.
Start and stop
The plugin only intercepts links when your router instance is started.
Usage
Basic
var linkInterceptor = ;var router = ; { if err console;} router;
With opts object
var linkInterceptor = ;var router = ; { if err console;} router;
With opts function
var linkInterceptor = ;var router = ; { if routeName === 'home' return reload: true; return {};} { if err console;} router;
Changelog
License
The MIT License.