roumuter
v0.0.3
Published
Support push state to history without navigate.
Downloads
1
Readme
roumuter
Support push state to history without navigate.
usage
import lib:
import Roumuter from 'roumuter'
create Roumuter store and subscribe
var Roumuter = new Roumuter({
path: '', // optional
params: ["sort", "order"] // support object, arrays of string key
})
// subscribe changed
Roumuter.subscribe(params => {
// => params: {sort: "..", order: ".."}
// all search query string u define at `params` of Roumuter.
})
navigate
Roumuter.navigate({sort: "Created", order: "ASC"});
// or
Roumuter.navigateTo(path, {sort: "Created", order: "ASC"});
// unsubscribe
Roumuter.unsubscribe();