dees-wcctools/ts_web/index.ts

20 lines
643 B
TypeScript
Raw Normal View History

2022-03-24 14:39:17 +00:00
import { WccDashboard } from './elements/wcc-dashboard.js';
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
};