armisa-models
Version:
models of armisa!
40 lines (39 loc) • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PageLoadByKey = void 0;
class PageLoadByKey {
constructor(mainStateManager) {
this.mainStateManager = mainStateManager;
this.pages = [];
this.add = (key, Page, ExtraPageToolStripItems) => {
const find = this.pages.find(i => i.pageKey === key);
if (find) {
find.Page = Page;
find.ExtraPageToolStripItems = ExtraPageToolStripItems;
}
else {
this.pages.push({ pageKey: key, Page, ExtraPageToolStripItems });
}
};
this.get = (key) => {
const find = this.pages.find(i => i.pageKey.toUpperCase() === key.toUpperCase());
if (find) {
return find;
}
else {
console.error(`can not find any page key : ${key}`);
throw Error(`can not find any page key : ${key}`);
}
};
this.isValid = (key) => {
const find = this.pages.find(i => i.pageKey === key);
if (find) {
return true;
}
else {
return false;
}
};
}
}
exports.PageLoadByKey = PageLoadByKey;