Compare commits

..

2 Commits

Author SHA1 Message Date
52c245d655 1.0.15 2020-05-25 16:12:00 +00:00
c2e0c0ab19 fix(core): update 2020-05-25 16:11:59 +00:00
3 changed files with 14 additions and 7 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@designestate/dees-domtools",
"version": "1.0.14",
"version": "1.0.15",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@designestate/dees-domtools",
"version": "1.0.14",
"version": "1.0.15",
"private": false,
"description": "tools to simplify complex css structures",
"main": "dist_ts/index.js",

View File

@ -10,8 +10,8 @@ export class DomTools {
// lets make sure the dom is ready
const readyStateChangedFunc = () => {
if (document.readyState === 'interactive' || document.readyState === 'complete') {
domToolsInstance.headElement = document.querySelector('head');
domToolsInstance.bodyElement = document.querySelector('body');
domToolsInstance.elements.headElement = document.querySelector('head');
domToolsInstance.elements.bodyElement = document.querySelector('body');
domToolsInstance.domReady.resolve();
}
};
@ -24,20 +24,27 @@ export class DomTools {
return domToolsInstance;
}
public smartstate = new plugins.smartstate.Smartstate();
public domToolsReady = plugins.smartpromise.defer();
public domReady = plugins.smartpromise.defer();
public globalStylesReady = plugins.smartpromise.defer();
// elements
public headElement: HTMLElement;
public bodyElement: HTMLElement;
public elements: {
headElement: HTMLElement;
bodyElement: HTMLElement;
} = {
headElement: null,
bodyElement: null,
};
public async setGlobalStyles(stylesText: string) {
await this.domReady.promise;
const styleElement = document.createElement('style');
styleElement.type = 'text/css';
styleElement.appendChild(document.createTextNode(stylesText));
this.headElement.appendChild(styleElement);
this.elements.headElement.appendChild(styleElement);
}
private runOnceTrackerStringMap = new Stringmap();