3 var MoreRouting = scope.MoreRouting = scope.MoreRouting || {};
4 MoreRouting.HashDriver = HashDriver;
9 function HashDriver() {
10 MoreRouting.Driver.apply(this, arguments);
14 HashDriver.prototype = Object.create(MoreRouting.Driver.prototype);
16 // By default, we prefer hashbang; but you can prefix with any string you wish.
17 HashDriver.prototype.prefix = '!/';
19 HashDriver.prototype.urlForParts = function urlForParts(parts) {
20 return '#' + MoreRouting.Driver.prototype.urlForParts.call(this, parts);
23 HashDriver.prototype.navigateToUrl = function navigateToUrl(url) {
24 window.location.hash = url;
27 HashDriver.prototype._bindEvents = function _bindEvents() {
28 window.addEventListener('hashchange', this._read.bind(this));
31 HashDriver.prototype._read = function _read() {
32 this.setCurrentPath(window.location.hash.substr(1) || this.prefix);