Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Created January 16, 2011 04:53
Show Gist options
  • Save heapwolf/781568 to your computer and use it in GitHub Desktop.
Save heapwolf/781568 to your computer and use it in GitHub Desktop.
routing by capture-group-value with sugarskull
var router = SS.router({
'foo/?([a-zA-Z0-9_\-]+)?': { // if the route 'foo/whatever' is matched...
'1': { // the first capture group
'bar': { // a potential value
on: ["barFunc"], // list of methods to fire on match
once: ["barOnce"], // optional, once only this route
state: { "someNumber": 100 } // optional, some data
}
},
noParams: true, // set if you dont want to pass capture group vals as params to functions
on: ["fooFunc"], // list of methods
once: ["fooFeatures"], // list of methods
state: { "someLetter": "A" } // data
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment