# router5-history

> History plugin for router5

Latest version **3.0.4** (published 2016-07-20) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install router5-history
pnpm add router5-history
yarn add router5-history
bun add router5-history
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.4 |
| Published | 2016-07-20 |
| First published | 2015-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Thomas Roch |
| Maintainers | troch |
| Keywords | router5, plugin, history, html5, router |

## Links

- npm: https://www.npmjs.com/package/router5-history
- Repository: https://github.com/router5/router5-history
- Homepage: http://router5.github.io
- Issues: https://github.com/router5/router5-history/issues
- npm.io page: https://npm.io/package/router5-history

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 3.0.4 (latest) — 2016-07-20
- 3.0.3 — 2016-04-01
- 3.0.2 — 2016-03-28
- 3.0.1 — 2016-03-24
- 3.0.0 — 2016-02-28
- 2.0.1 — 2016-02-23
- 2.0.0 — 2016-01-19
- 2.0.0-rc.1 — 2016-01-18
- 1.0.1 — 2015-12-02
- 1.0.0 — 2015-10-27
- 1.0.0-rc1 — 2015-10-20

## README

[![npm version](https://badge.fury.io/js/router5-history.svg)](https://badge.fury.io/js/router5-history)
[![Build Status](https://travis-ci.org/router5/router5-history.svg?branch=master)](https://travis-ci.org/router5/router5-history?branch=master)
[![Coverage Status](https://coveralls.io/repos/router5/router5-history/badge.svg?branch=master&service=github)](https://coveralls.io/github/router5/router5-history?branch=master)

# 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

```javascript
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.

```js
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](https://github.com/router5/router5/blob/master/CONTRIBUTING.md) on router5 repository.

---
_Source: https://npm.io/package/router5-history · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
