Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
before and after filter support for backbone.js
JavaScript
Branch: master

Merge pull request #4 from obsidianart/patch-1

Update backbone_filters.js
latest commit 643e4990e8
@angelo0000 authored
Failed to load latest commit information.
README.md Update README.md
backbone_filters.js Update backbone_filters.js

README.md

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:

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.

Something went wrong with that request. Please try again.