@macrof/shared
Version:
React MicroFrontend Shared, Typescript, Webpack 5, ModuleFederation
18 lines (17 loc) • 681 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mfHistory = void 0;
const history_1 = require("history");
const mobx_1 = require("mobx");
const utils_1 = require("../utils");
const lastHashed = mobx_1.observable.object({ key: '' });
exports.mfHistory = ((history) => () => {
// eslint-disable-next-line no-param-reassign
history.navigate = function navigate(key, isDefault) {
if (isDefault || (key !== lastHashed.key && !(0, utils_1.includedPath)(key, this.location.pathname))) {
lastHashed.key = key;
this.push(key);
}
};
return history;
})((0, history_1.createBrowserHistory)(window));