0.2.1 • Published 10 years ago

routemachine v0.2.1

Weekly downloads
23
License
-
Repository
github
Last release
10 years ago

routemachine

Stateful client-side router

Install

Browserify:

npm install routemachine

Component:

component install scttnlsn/routemachine

Usage

var routemachine = require('routemachine');
var router = routemachine();

var foo = {
    url: '/foo',

    enter: function () {
        console.log('enter foo');
    },

    exec: function () {
        console.log('exec foo');
    }
};

var bar = {
    url: '/foo/bar',

    enter: function () {
        console.log('enter bar');
    },

    exec: function () {
        console.log('exec bar');
    },

    exit: function () {
        console.log('exit bar');
    }
};

router.define(function (root) {
    root.define('foo', foo, function (foo) {
        foo.define('bar', bar);
    });
});

router.navigate('/foo/bar');
// => enter foo
// => enter bar
// => exec bar
router.navigate('/foo');
// => exit bar
// => exec foo
0.2.1

10 years ago

0.2.0

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago