UNPKG

ui-router-core

Version:

UI-Router Core: Framework agnostic, State-based routing for JavaScript Single Page Apps

35 lines 1.41 kB
"use strict"; 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 */ /** */ var utils_1 = require("./utils"); var baseLocationService_1 = require("./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 utils_1.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; }(baseLocationService_1.BaseLocationServices)); exports.HashLocationService = HashLocationService; //# sourceMappingURL=hashLocationService.js.map