addyosmani / addyosmani/page-router

consider combining with <url-route>

Ouverte
#1 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
CSS
Étoiles
16
Forks
1
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.