Skip to content
This repository has been archived by the owner on Mar 8, 2019. It is now read-only.
/ history Public archive

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

Notifications You must be signed in to change notification settings

ianstormtaylor/history

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published