properjs-historia

0.1.0 • Public • Published

ProperJS // Historia

JS history state attuned for any hero.

Installation

npm i properjs-historia --save-dev

Usage

Alone this utility may not be that useful, which is why it's used with the ProperJS/Router.

import Historia from "properjs-historia";
 
const historia = new Historia({
    // Force Hash state instead...
    forceHash: false, // Default
});
 
historia.on( "popstate", ( url, state ) => {
    console.log( url, state );
});
 
// Push state to address bar
historia.push( "http://localhost:9999/some/url" );
 
// Go back in history
setTimeout(() => {
    historia.goBack();
 
}, 2000 );
 
// Go forward in history
setTimeout(() => {
    historia.goForward();
 
}, 4000 );

Package Sidebar

Install

npm i properjs-historia

Weekly Downloads

3

Version

0.1.0

License

none

Unpacked Size

8.33 kB

Total Files

7

Last publish

Collaborators

  • kitajchuk