/router5-listeners

Listeners plugin for router5 [DEPRECATED]

Primary LanguageJavaScriptMIT LicenseMIT

npm version Build Status Coverage Status

[DEPRECATED] router5-listeners

From version 4 and above of router5, this module is no longer needed and code has been moved to router5 main repo. Refer to http://router5.github.io/docs/migration-4.html for more details.

Listeners plugin for router5@3.0.0.

How to install

The dist folder contains:

  • AMD bundled (with minifed version) named router5ListenersPlugin
  • Browser module-less bundle (with minified version) adding to the globals router5ListenersPlugin
  • UMD and CommonJs files

Sources are distributed through:

  • bower (bower install router5-listeners)
  • npm (npm install --save router5-listeners)

How to use

import { Router5 }     from 'router5';
import listenersPlugin from 'router5-listeners';

const router = new Router5()
    .addNode('home', '/home')
    .usePlugin(listenersPlugin());

API

This plugin adds the following methods to your router instance:

  • addListener(fn)
  • removeListener(fn)
  • addNodeListener(nodeName, fn)
  • removeNodeListener(nodeName, fn)
  • addRouteListener(routeName, fn)
  • removeRouteListener(routeName, fn)

Contributing

Please read contributing guidelines on router5 repository.