juliangruber / History
Browser-like history object
Programming Languages
javascript
184084 projects - #8 most used programming language
history
Browser-like history object
Example
var History = require('history');
var history = new History();
history.go('one'); // current: 'one'
history.go('two'); // current: 'two'
history.back(); // current: 'one'
history.back(); // current: 'one'
history.go('ooh'); // current: 'ooh'
history.back(); // current: 'one'
Installation
Install with component(1):
$ component install juliangruber/history
Install with npm:
$ npm install juliangruber/history
API
History()
Create a new history.
History#go(state)
Go to state
.
If the current state
isn't at the end of the history, the rest will be removed, just like browsers do.
History#back()
Go back.
History#forward()
Go forward.
History#current()
Get the current state
.
History#on('go', fn(state))
Listen for state
changes.
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].