AmpersandJS / ampersand-router

Clientside router with fallbacks for browsers that don't support pushState. Mostly lifted from Backbone.js.
MIT License
70 stars 16 forks source link

Extract History and Router into independent modules. #33

Open Prestaul opened 9 years ago

Prestaul commented 9 years ago

Is there a reason that I cannot use History without Router and visa versa? I'm curious is this was a design decision or just the result of the Backbone port. The current implementation prevents the router from being used outside of the browser.

Honestly, I'd love to see 3 modules:

  1. History/pushState - A client-side module that manages browser history for me and provides events for state change.
  2. Route matching and URL interpolation - Basically I want to map from a URL to a route and params, and from a route and params back to a URL. Could be used client-side or in node.
  3. The whole enchilada - A fancy facade that wraps these two together for me on the client. Basically what this module is today (plus url interpolation FTW).
wraithgar commented 9 years ago

Yeah pretty sure this is just Backbone legacy that nobody's refactored yet.

This is essentially what we did with ampersand-subcollection, breaking it into its two constituents: filtering and pagination. We haven't refactored subcollection to use the new modules but it's in the works. It makes sense to do the same here too.