Created
January 16, 2011 04:53
-
-
Save heapwolf/781568 to your computer and use it in GitHub Desktop.
routing by capture-group-value with sugarskull
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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