| OLD | NEW |
| (Empty) |
| 1 | |
| 2 (function(scope) { | |
| 3 var MoreRouting = scope.MoreRouting = scope.MoreRouting || {}; | |
| 4 MoreRouting.PathDriver = PathDriver; | |
| 5 | |
| 6 /** | |
| 7 * TODO(nevir): Docs. | |
| 8 */ | |
| 9 function PathDriver() { | |
| 10 MoreRouting.Driver.apply(this, arguments); | |
| 11 this._bindEvents(); | |
| 12 this._read(); | |
| 13 } | |
| 14 PathDriver.prototype = Object.create(MoreRouting.Driver.prototype); | |
| 15 | |
| 16 PathDriver.prototype.navigateToUrl = function navigateToUrl(url) { | |
| 17 window.history.pushState({}, '', url); | |
| 18 this._read(); | |
| 19 }; | |
| 20 | |
| 21 PathDriver.prototype._bindEvents = function _bindEvents() { | |
| 22 window.addEventListener('popstate', this._read.bind(this)); | |
| 23 }; | |
| 24 | |
| 25 PathDriver.prototype._read = function _read() { | |
| 26 this.setCurrentPath(window.location.pathname); | |
| 27 }; | |
| 28 | |
| 29 })(window); | |
| OLD | NEW |