npm.io
0.0.3 • Published 7 years ago

roumuter

Licence
MIT
Version
0.0.3
Deps
1
Size
35 kB
Vulns
0
Weekly
0
Stars
1

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();