Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
4db0e6f5fc | |||
40b8c5010d |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-domtools",
|
"name": "@designestate/dees-domtools",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@designestate/dees-domtools",
|
"name": "@designestate/dees-domtools",
|
||||||
"version": "1.0.5",
|
"version": "1.0.6",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "tools to simplify complex css structures",
|
"description": "tools to simplify complex css structures",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -8,7 +8,10 @@ export const elementBasicSetup = async () => {
|
|||||||
if (globalThis.deesCssToolsReady) {
|
if (globalThis.deesCssToolsReady) {
|
||||||
await globalThis.deesCssToolsReady.promise;
|
await globalThis.deesCssToolsReady.promise;
|
||||||
} else {
|
} else {
|
||||||
|
// lets prevent double execution
|
||||||
globalThis.deesCssToolsReady = defer();
|
globalThis.deesCssToolsReady = defer();
|
||||||
|
|
||||||
|
// lets make sure the dom is ready
|
||||||
const documentReady = defer();
|
const documentReady = defer();
|
||||||
document.onreadystatechange = () => {
|
document.onreadystatechange = () => {
|
||||||
if (document.readyState === 'interactive') {
|
if (document.readyState === 'interactive') {
|
||||||
@ -16,10 +19,26 @@ export const elementBasicSetup = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
await documentReady.promise;
|
await documentReady.promise;
|
||||||
|
|
||||||
|
// lets get started
|
||||||
const head = document.querySelector('head');
|
const head = document.querySelector('head');
|
||||||
|
const body = document.querySelector('body');
|
||||||
|
|
||||||
|
// material font
|
||||||
|
const materialFontCss = `
|
||||||
|
@font-face {
|
||||||
|
font-family: 'Material Icons';
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
src: url(https://fonts.gstatic.com/s/materialicons/v42/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2) format('woff2');
|
||||||
|
}
|
||||||
|
`;
|
||||||
const styleElement = document.createElement('style');
|
const styleElement = document.createElement('style');
|
||||||
styleElement.type = 'text/css';
|
styleElement.type = 'text/css';
|
||||||
styleElement.appendChild(document.createTextNode(materialFontCss));
|
styleElement.appendChild(document.createTextNode(materialFontCss));
|
||||||
|
head.appendChild(styleElement);
|
||||||
|
|
||||||
|
|
||||||
globalThis.deesCssToolsReady.resolve();
|
globalThis.deesCssToolsReady.resolve();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user