26 lines
788 B
TypeScript
26 lines
788 B
TypeScript
import { defer } from '@pushrocks/smartpromise';
|
|
|
|
/**
|
|
* a basic setup for elements
|
|
* makes sure everything is in check
|
|
*/
|
|
export const elementBasicSetup = async () => {
|
|
if (globalThis.deesCssToolsReady) {
|
|
await globalThis.deesCssToolsReady.promise;
|
|
} else {
|
|
globalThis.deesCssToolsReady = defer();
|
|
const documentReady = defer();
|
|
document.onreadystatechange = () => {
|
|
if (document.readyState === 'interactive') {
|
|
documentReady.resolve();
|
|
}
|
|
};
|
|
await documentReady.promise;
|
|
const head = document.querySelector('head');
|
|
const styleElement = document.createElement('style');
|
|
styleElement.type = 'text/css';
|
|
styleElement.appendChild(document.createTextNode(materialFontCss));
|
|
globalThis.deesCssToolsReady.resolve();
|
|
}
|
|
};
|