0.2.1 • Published 9 years ago

@yuheiy/simple-url-dispatcher v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

Simple URL Dispatcher

The dispatcher to divide methods of client-side JavaScript according to URL.

Installation

$ npm install @yuheiy/simple-url-dispatcher --save

Usage

var Dispatcher = require('@yuheiy/simple-url-dispatcher');
var dispatcher = new Dispatcher();

dispatcher.route('*', function () {
  console.log('run on all pages');
});

dispatcher.route('/', '/index.html', function () {
  console.log('index');
});

dispatcher.route('/about', function () {
  console.log('about');
});

dispatcher.route('/user/:id', function (params) {
  console.log('user', params.id);
});

// run url methods
dispatcher.run();
0.2.1

9 years ago

0.2.0

9 years ago

0.1.0

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago