"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeHistory = exports.createHistory = void 0;
const history_1 = require("history");
const adapter_1 = require("./adapter");
// 显式声明HASH 或 app 的 路由使用 hash router，而其他web应用使用 BrowserRouter
const createHistory = (options, type = 'browser') => {
    let history;
    switch (type) {
        case 'hash':
        case 'HASH':
            history = (0, history_1.createHashHistory)(Object.assign({ basename: '' }, options));
            break;
        case 'memory':
        case 'MEMORY':
            history = (0, history_1.createMemoryHistory)();
            break;
        default:
            history = (0, history_1.createBrowserHistory)(options);
    }
    adapter_1.runtime._WEAPPS_HISTORY = history;
    return history;
};
exports.createHistory = createHistory;
const removeHistory = () => {
    adapter_1.runtime._WEAPPS_HISTORY = undefined;
};
exports.removeHistory = removeHistory;
//# sourceMappingURL=history.js.map