A nicer wrapper around the browser's History API. Push, replace, back, forward, etc.
$ component install ianstormtaylor/history
var history = require('history');
history.push('/one');
history.push('/two');
history.back();
history.path(); // "/one"
Get the current path. (window.location.pathname
)
Get the current state. (window.history.state
)
Push the path
onto the history stack, with an optional state
object.
Replace the current path with a new path
, and optional state
object.
Move backward an optional number of steps
, defaults to 1
. Aliased to backward()
for consistency.
Move forward an optional number of steps
, defaults to 1
.
MIT