armisa-models
Version:
models of armisa!
31 lines (30 loc) • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LazyLoadFactory = void 0;
class LazyLoadFactory {
constructor(mainStateManager) {
this.mainStateManager = mainStateManager;
this.pages = [];
this.add = (key, path) => {
const find = this.pages.find(i => i.pageKey === key);
if (find) {
find.path = path;
}
else {
this.pages.push({ pageKey: key, path });
}
};
this.get = (key) => {
const find = this.pages.find(i => i.pageKey === key);
if (find) {
throw Error(`can not find any page key : ${key}`);
// return lazy(() => find.path)
}
else {
console.error(`can not find any page key : ${key}`);
throw Error(`can not find any page key : ${key}`);
}
};
}
}
exports.LazyLoadFactory = LazyLoadFactory;