diff options
Diffstat (limited to 'public/assets/js/vendor/view/router.js')
| -rw-r--r-- | public/assets/js/vendor/view/router.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/public/assets/js/vendor/view/router.js b/public/assets/js/vendor/view/router.js index 0f977e0..3fc3357 100644 --- a/public/assets/js/vendor/view/router.js +++ b/public/assets/js/vendor/view/router.js @@ -1,6 +1,15 @@ var Router = View.extend({ routeByHash: false, + initialize: function () { + window.addEventListener("popstate", this.onpopstate.bind(this)); + }, + + onpopstate: (event) => { + console.log("POP STATE", document.location.pathname); + app.router.parseRoute(document.location.pathname); + }, + go: function (url) { this.parseRoute(url); }, @@ -9,6 +18,7 @@ var Router = View.extend({ if (this.routeByHash) { window.location.hash = url; } else if (window.history) { + console.log(url); window.history.pushState(null, null, url); } }, |
