dees-wcctools/ts_web/index.ts

20 lines
640 B
TypeScript
Raw Permalink Normal View History

2020-05-11 00:36:58 +00:00
import { WccDashboard } from './elements/wcc-dashboard';
2020-05-24 20:09:37 +00:00
import { LitElement, TemplateResult } from 'lit-element';
2020-11-27 17:09:33 +00:00
const setupWccTools = (elementsArg?: { [key: string]: LitElement }, pagesArg?: { [key: string]: () => TemplateResult }) => {
2020-05-24 20:09:37 +00:00
let hasRun = false;
const runWccToolsSetup = async () => {
if (document.readyState === 'complete' && !hasRun) {
hasRun = true;
const wccTools = new WccDashboard(elementsArg as any, pagesArg);
document.querySelector('body').append(wccTools);
}
};
document.addEventListener('readystatechange', runWccToolsSetup);
runWccToolsSetup();
};
2020-05-10 23:14:17 +00:00
export {
2020-05-24 20:09:37 +00:00
setupWccTools
2020-05-10 23:14:17 +00:00
};