erikringsmuth / app-router

Router for Web Components
https://erikringsmuth.github.io/app-router/
MIT License
610 stars 83 forks source link

History state on popstate/state-change #126

Closed jmalonzo closed 9 years ago

jmalonzo commented 9 years ago

Hi Erik,

If mode=pushstate, is it possible to include the history.state when you fire state-change?

Thanks.

erikringsmuth commented 9 years ago

It sounds like a good idea. The popstate handler and the code to create the model https://github.com/erikringsmuth/app-router/blob/master/src/app-router.js#L357 are pretty far apart so it'd be hard to do only when popstate is fired, but it probably wouldn't hurt to mix-in the properties window.history.state in the createModel() function on all state changes. Want to try it out and submit a PR?