addyosmani / addyosmani/backbone-fundamentals

Chapter 3, Routers section

未关闭
#575 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
confirmed
主要语言
Rich Text Format
星标
9.2k
派生
1.4k
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。