Skip to content

Latest commit

 

History

History
67 lines (37 loc) · 967 Bytes

README.md

File metadata and controls

67 lines (37 loc) · 967 Bytes

backbone-router

Backbone.Router component

Installation

$ component install spini/backbone-router

History stuff

It provides Router.history instead of Backbone.history

Example

var Router = require('spini-backbone-router');

var Workspace = Router.extend({

  routes: {
    "help":                 "help",    // #help
    "search/:query":        "search",  // #search/kiwis
    "search/:query/p:page": "search"   // #search/kiwis/p7
  },

  help: function() {
    ...
  },

  search: function(query, page) {
    ...
  }

});

instantiate your Router


var myrouter = new Router(options);

and then start history


Router.history.start({pushState: true});

// or

Router.history.start();

API

See documentation for Backbone.Router

License

MIT