All Projects → ianstormtaylor → history

ianstormtaylor / history

Licence: other
A nicer wrapper around the browser's History API. Push, replace, back, forward, etc.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

history

A nicer wrapper around the browser's History API. Push, replace, back, forward, etc.

Installation

$ component install ianstormtaylor/history

Example

var history = require('history');

history.push('/one');
history.push('/two');
history.back();
history.path(); // "/one"

API

.path()

Get the current path. (window.location.pathname)

.state()

Get the current state. (window.history.state)

.push(path, [state])

Push the path onto the history stack, with an optional state object.

.replace(path, [state])

Replace the current path with a new path, and optional state object.

.back(steps)

Move backward an optional number of steps, defaults to 1. Aliased to backward() for consistency.

.forward(steps)

Move forward an optional number of steps, defaults to 1.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].