hello-router

1.0.0 • Public • Published

hello-router

Build Status

client-side router for SPA


Install

npm install hello-router

API

  • .register(uri, action)
  • .activate(uri)
  • .dispatch(uri)
  • .redirect(uri)
  • .run()

Usage

var router = helloRouter;

router.register('/a', function () {
	// do something
	
	router.redirect('/b');
	// ignore follow code
});

router.register('/b', function () {
	// do something
	
	router.dispatch('/404');
	// ignore follow code
});

router.register('/404', function () {
	// do something
});

router.run();

// <a href="/hello/router?age=1"></a>
$('a').click(function () {
	router.active(this.href);
	return false;
});

/hello-router/

    Package Sidebar

    Install

    npm i hello-router

    Weekly Downloads

    1

    Version

    1.0.0

    License

    ISC

    Last publish

    Collaborators

    • daifee