Skip to content
This repository has been archived by the owner on Sep 6, 2020. It is now read-only.

nnnnathann/backbone-delegating-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

backbone-delegating-router

Router with ability to specify a delegate object

Forked from a gist here: stephenhandley

class Client
  constructor:()->
    @router = new DelegateRouter(
      delegate: this
      routes: 
        "barf/:something": "barf"
        "barfed/:one/:two": "barfed"
        "": "index"
        ":all": "all"
    )
  
  barf: (something)->
  barfed: (one, two)->
  index: ()->
function Delegate(routes) {
  this.router = new DelegatingRouter({
    delegate: this,
    routes: routes
  });
}

Delegate.prototype.barf = function(something) { console.log(["barf", something]); };
Delegate.prototype.barfed = function(one, two) { console.log(["barfed", one, two]) };
Delegate.prototype.index = function() { console.log("index"); };

new Delegate({
  "barf/:something": "barf",
  "barfed/:one/:two": "barfed",
  "": "index"
});

About

Router with ability to specify a delegate object

Resources

Stars

Watchers

Forks

Packages

No packages published