This package has been deprecated

Author message:

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.

router5-history

3.0.4 • Public • Published

npm version Build Status Coverage Status

router5-history

HTML5 history for router5: http://router5.github.io

How to install

The dist folder contains:

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

Sources are distributed through:

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

How to use

import { Router5 }     from 'router5';
import historyPlugin   from 'router5-history';
 
const router = new Router5()
    .addNode('home', '/home')
    .usePlugin(historyPlugin());

Options

You can specify whether or not current active segments deactivation should be forced on popstate events. By default this is false but I recommend setting it to true to keep a clean history.

router.usePlugin(historyPlugin({ forceDeactivate: true }));

What does it do?

  • Uses the history API to update history state and URL on router5 state changes
  • Listens to popstate events (back and forward buttons, manual changes of URL)

Replacing history

Sometimes, you might want to silently replace the current history entry. This plugin decorates your router instance with a replaceHistoryState(name, params) function. The new state provided will also replace the router last known state. Use with care, this could affect the next transition.

Contributing

Please read contributing guidelines on router5 repository.

Package Sidebar

Install

npm i router5-history

Weekly Downloads

28

Version

3.0.4

License

MIT

Last publish

Collaborators

  • troch