Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/angelo0000/backbone_filters
before and after filter support for backbone.js
https://github.com/angelo0000/backbone_filters
Last synced: about 2 months ago
JSON representation
before and after filter support for backbone.js
- Host: GitHub
- URL: https://github.com/angelo0000/backbone_filters
- Owner: angelo0000
- Created: 2011-08-12T18:41:15.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-09-22T01:30:22.000Z (about 11 years ago)
- Last Synced: 2024-05-27T11:36:24.568Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 107 KB
- Stars: 75
- Watchers: 5
- Forks: 24
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
_Disclaimer: This fork has been updated to work with Backbone 0.5.3_
# Usage
Include `backbone_filters.js` after Backbone.
In your router you can now add:
```javascript
before: {
'^clerks' : function() {
/* do stuff to all routes starting with 'clerks' */
/* return false to halt execution */
},
'another reg ex' : function() { }
},after: {
'^clerks' : function() {
/* do stuff */
},
'another reg ex' : function() { }
}
```Your filters will be called and if a filter returns false, the filter chain is halted.
If a before filter chain is halted, the action in the Router will not be called. Your
filters will receive the same arguments that get passed to the actions.