Repository URL to install this package:
|
Version:
1.2.10 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.RouterStore = void 0;
var _mobx = require("xmobx/mobx");
var _desc, _value, _class;
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
var desc = {};
Object['ke' + 'ys'](descriptor).forEach(function (key) {
desc[key] = descriptor[key];
});
desc.enumerable = !!desc.enumerable;
desc.configurable = !!desc.configurable;
if ('value' in desc || desc.initializer) {
desc.writable = true;
}
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
return decorator(target, property, desc) || desc;
}, desc);
if (context && desc.initializer !== void 0) {
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
desc.initializer = undefined;
}
if (desc.initializer === void 0) {
Object['define' + 'Property'](target, property, desc);
desc = null;
}
return desc;
}
let RouterStore = (_class = class RouterStore {
constructor() {
this.push = location => {
this.history.push(location);
};
this.replace = location => {
this.history.replace(location);
};
this.go = route => {
this.history.go(route);
};
this.goBack = () => {
this.history.goBack();
};
this.goForward = () => {
this.history.goForward();
};
this.location = (0, _mobx.observable)(undefined);
this.history = (0, _mobx.observable)(undefined);
}
_updateLocation(newState) {
this.location = newState;
}
/**
* --------------
* history methods
*/
}, (_applyDecoratedDescriptor(_class.prototype, "_updateLocation", [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, "_updateLocation"), _class.prototype)), _class);
exports.RouterStore = RouterStore;