ui-router-core
Version:
UI-Router Core: Framework agnostic, State-based routing for JavaScript Single Page Apps
34 lines • 1.36 kB
JavaScript
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
* @internalapi
* @module vanilla
*/
/** */
import { trimHashVal } from "./utils";
import { BaseLocationServices } from "./baseLocationService";
/** A `LocationServices` that uses the browser hash "#" to get/set the current location */
var HashLocationService = (function (_super) {
__extends(HashLocationService, _super);
function HashLocationService(router) {
var _this = _super.call(this, router, false) || this;
window.addEventListener('hashchange', _this._listener, false);
return _this;
}
HashLocationService.prototype._get = function () {
return trimHashVal(this._location.hash);
};
HashLocationService.prototype._set = function (state, title, url, replace) {
this._location.hash = url;
};
HashLocationService.prototype.dispose = function (router) {
_super.prototype.dispose.call(this, router);
window.removeEventListener('hashchange', this._listener);
};
return HashLocationService;
}(BaseLocationServices));
export { HashLocationService };
//# sourceMappingURL=hashLocationService.js.map