jamesplease / jamesplease/router-comparison

Multiple routers registering same route support (subrouters)

Open
#32 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
38
Forks
0
PR merge metrics
No merged PRs in 30d

Description

I've talked to you about this in the past, but one of my biggest qualms with Backbone's router is the inability to register the same route more than once. For instance if you were to have a router for two widgets that want to bind to the same route (say posts/); the first wants to render the post the second widget wants to display some statistics on the amount of views on the post

``` js
var AppRouter = Backbone.Router.extend({
routes: {
"posts/:id": "getPost"
}
});

var app_router = new AppRouter;

app_router.on('route:getPost', function( id ){
console.log('router 1', id);
});

var app_router2 = new AppRouter;

app_router2.on('route:getPost', function( id ){
console.log('router 2', id);
});

Backbone.history.start({pushState: false});

app_router.navigate('posts/5', {trigger: true})
```

Only one router registers the navigate =/

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Backbone example in the issue and inspect the router implementations covered by this comparison, tracing how route registration and navigation are handled. Done means the project documents or demonstrates support for multiple routers or widgets receiving the same posts/:id route, with behavior matching the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.