addyosmani / addyosmani/page-router
consider combining with <url-route>
未关闭
- 主要语言
- CSS
- 星标
- 16
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello, I wrote [``](https://github.com/codemix/url-route) which does some pretty similar stuff to ``. It would be nice to combine them. The two libraries take some different approaches:
1. `` is focussed on conditionally displaying elements, so you can do something like this:
``` html
I will only be displayed when the page fragment is
#wat
```
Whereas `` is all about declaring routes and then emitting events. It would be possible to support a similar use case in ``:
``` html
```
``` js
document.addEventListener('route-changed', function (route) { });
// or
document.addEventListener('route:wat', function (route) { });
```
2. `` uses director.js whereas `` rolls its own with a syntax stolen from the Yii php framework.
``` html
```
vs
``` html
```
Personally I like ours better (of course :smile:) simply because afaik director.js does not support the definition of named patterns inline (e.g. specifying that `id` in the example above can only be an integer). It appears that director.js's approach is to declare those special cases ahead of time which I think is inconvenient here. Also i'm unsure whether director's approach works with real URLs (`pushState` etc), and not just fragment based ones, whereas this works with both. It's nice if you're already using director of course, but most apps probably aren't.
WDYT?
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。