nl_tokens: Takes a single callback that is pushed on to a stack . Before any route is run the callbacks are evaluated in order within the current Sammy . EventContext If any of the callbacks explicitly return false execution of any further callbacks and the route itself is halted . You can also provide a set of options that will define when to run this before based on the route it proceeds . ### Example var app = $ . sammy ( function () { // will run at # / route but not at # / this . before ( # / route function () { // ... } ) ; // will run at # / but not at # / route this . before ( { except : { path : # / route }} function () { this . log ( not before # / route ) ; } ) ; this . get ( # / function () {} ) ; this . get ( # / route function () {} ) ; } ) ; See contextMatchesOptions () for a full list of supported options
pl_tokens: function ( options , callback ) { if ( _isFunction ( <mask> ) ) { callback = options ; options = { } ; } this . befores . push ( [ options , callback ] ) ; return this ; }