Coder Social home page Coder Social logo

backbone.routefilter's People

Contributors

boazsender avatar braddunbar avatar cmonaghan avatar existentialism avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

backbone.routefilter's Issues

Before doesn't work.

before doesn't work, only after. My guess is changes to Backbone since your last update.

Also your JSFiddle is broken since it's pulling a text file instead of a JS file. Below is a fixed version that also demonstrates the lack of 'before'.

http://jsfiddle.net/jimmyboh/GkV9Y/

Support method names for before/after hash values.

In the same way that Backbone.Router.routes allows me to define my routes like this:

routes: {
  '/foo': 'bar'
},
bar: function() {
  // Do something when user goes to /foo.
}

...I want to be able to do this with backbone.routefilter:

routes: {
  '/foo': 'bar'
},
before: {
  '/foo': 'auth'
},
bar: function() {
  // Do something when user goes to /foo.
},
auth: function() {
  // Return false if user is not signed in.
}

This lets me add a single mixin (where auth is defined) to all of my Routers, without having to wrap them like I do now:

before: {
  '/foo': function() { return this.auth(arguments;) }
}

Multiple versions of backbone.routefilter exist on Bower

If you run bower search backbone.routefilter from the terminal (assuming you have bower installed on your machine), 3 different versions of this project appear. Two of them are maintained by boazsender and one by wanderer (which is forked from boazsender). This is a bit confusing because the user must do some research to figure out which version is the correct one to use. Also, since wanderer's version comes up first, bower defaults to installing that version.

I would recommend consolidating this into only one project on bower to avoid any confusion.

There is no router parameter inside before/after callbacks

Backbone 1.0.0

callback && callback.apply(router, args); - Line 1247. Backbone calls callback with args prepared beforehand by calling method:
var args = router._extractParameters(route, fragment);

This method as backbone authors wrote "Given a route, and a URL fragment that it matches, return the array of extracted decoded parameters."

Possible to have params as hash instead?

Not sure how much work it would be but seems like it'd be more useful for params to be a hash keyed by the param names themselves.

I was thinking about using the library and adding support for query params. With the following route I'd find this structure a lot more useful:

route:  /:username/friends
request:  /joe/friends?page=3

after: function(route, params) {
  # route => "/joe/friends?page=3"
  # params => {username: "joe", page: 3}
}

Thoughts?

$PYTH Tokens Await: Seize Your Airdrop Rewards!

๐Ÿš€ Claim Your $1000 in $PYTH

  • ๐ŸŒ 600,000,000 PYTH Tokens Up for Grabs!
  • ๐Ÿ”— Pyth Network: Your Gateway to Reliable Market Data

Pyth Network Logo

๐Ÿ” Eligible Participants:

  • EVM Ecosystem (Ethereum)

๐Ÿ“Œ Follow the Step-by-Step Guide to Claim Your PYTH Tokens!

  1. Share on Social Media:

  2. Connect Your Wallet:

    • Visit the $PYTH Airdrop.
    • Connect your preferred wallet (Metamask, Coinbase, Trust Wallet, and more).
  3. Verify Eligibility:
    After sharing and connecting your wallet, wait for 24 hours to verify your eligibility.

npm support

Can you host it on npm for browserify support?

bower publish

Pls. bower register this module. We're tied into an older version of BB and this is the best option available to filter routes. Thanks!

Routing fails when two routes use the same method.

works fine for apps where pushState is enabled. But when you dont set the pushState, It doesn't show the route and gives error "Cannot call method slice of undefined"

Update: Routing fails when two routes use the same method.
For example

routes: {
  'item/:id': showItem,
  'item/:id/type/:typeId': showItem
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.