addyosmani / addyosmani/backbone-fundamentals

Chapter 3, Routers section

Open
#575 1 comment 0 reactions 0 assignees View on GitHub
confirmed
Dominant language
Rich Text Format
Stars
9.2k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

At the very end of the Routers section the following explanation and code:

**A "route" event is also triggered on the router in addition to being fired on Backbone.history**.

```
Backbone.history.on('route', onRoute);

// Trigger 'route' event on router instance.
router.on('route', function(name, args) {
console.log(name === 'routeEvent');
});

location.replace('http://example.com#route-event/x');
Backbone.history.checkUrl();
```

Is the objective to show that by binding the 'route' event to history and Router, you may monitor URL changes?.

Perhaps the example would become more clear if instead of 'onRoute', an actual function and an explanation of the difference between the two were provided with a reference to the docs for more information.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.