UNPKG

1.82 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 };
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15Object.defineProperty(exports, "__esModule", { value: true });
16exports.HashLocationService = void 0;
17var common_1 = require("../common");
18var baseLocationService_1 = require("./baseLocationService");
19/** A `LocationServices` that uses the browser hash "#" to get/set the current location */
20var HashLocationService = /** @class */ (function (_super) {
21 __extends(HashLocationService, _super);
22 function HashLocationService(router) {
23 var _this = _super.call(this, router, false) || this;
24 common_1.root.addEventListener('hashchange', _this._listener, false);
25 return _this;
26 }
27 HashLocationService.prototype._get = function () {
28 return common_1.trimHashVal(this._location.hash);
29 };
30 HashLocationService.prototype._set = function (state, title, url, replace) {
31 this._location.hash = url;
32 };
33 HashLocationService.prototype.dispose = function (router) {
34 _super.prototype.dispose.call(this, router);
35 common_1.root.removeEventListener('hashchange', this._listener);
36 };
37 return HashLocationService;
38}(baseLocationService_1.BaseLocationServices));
39exports.HashLocationService = HashLocationService;
40//# sourceMappingURL=hashLocationService.js.map
\No newline at end of file