npm.io
0.0.4 • Published 2 years ago

hishim

Licence
MIT
Version
0.0.4
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
2

Hishim

History API Shim for non-browser env


Installation

npm i hishim

Usage

import History from 'hishim'

const history = new History({
	handleBack(oldCurrent, newCurrent, next) {...},
	handleForward(oldCurrent, newCurrent, next) {...},
	handlePushState(oldCurrent, newCurrent, next) {...},
	handleReplaceState(oldCurrent, newCurrent, next) {...}
})
interface CurrentState {
	state: any, // your state
	idx: number, // index of the current state
	url: string, // url of this state
	title: string, // page title of this state
	prev: CurrentState, // previous state
	next: Current // next state
}

License

MIT

Keywords