1.0.2 • Published 3 years ago

@af-modules/router v1.0.2

Weekly downloads
13
License
Apache-2.0
Repository
github
Last release
3 years ago

AF Router CCC

Greenkeeper badge Build Status Coverage Status

AF Router is a single page application router. It allows to easily attach listeners to state changes.

Installation

npm i --save @af-modules/router

How to Use

import Router from '@af-modules/router';

Router.init([
    {
        path: ['/', '/home'],
        onEnter: (path) => {...},   
        onLeave: (path) => {...},
        isPersistent: true,
    },
    {
        path: '/home/details',
        onEnter: (path) => {...},
        onLeave: (path) => {...},
        isPersistent: true,
    }

]);

Router.restore();

API

Router.init([{ path: string, onEnter: Function, onLeave: Function, isPersistent: boolean }]);

The init() method initializes the router. An array of objects can be specified to define the initial states.

Router.restore();

Restores the state of the application the last time it was open. Call this method if users should be able to return to the application in the same state they left.

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago