Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 635 Bytes

README.md

File metadata and controls

20 lines (16 loc) · 635 Bytes

_Disclaimer: This fork has been updated to work with Backbone 0.9.2

Usage

Include backbone_filters.js after Backbone.

In your router you can now add:

before: {
	'^clerks' : function( args , regexpResult ) {
		/* do stuff to all routes starting with 'clerks' */
		/* return deferred resolved when before filter applied , reject deferred to alter execution */
		/* regexpResult Match found on your regexp*/
	},
	'another reg ex' : function() { }
}

If a before filter deferred is rejected, the action in the Router will not be called. Your filters will receive the same arguments that get passed to the actions.