@mrhenry/custom-elements-helpers
Advanced tools
Comparing version 2.5.8 to 2.6.0
{ | ||
"name": "@mrhenry/custom-elements-helpers", | ||
"version": "2.5.8", | ||
"version": "2.6.0", | ||
"description": "A collection of Custom Elements v1 helpers", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
export default function waitForDOMReady() { | ||
return new Promise((resolve) => { | ||
if (document.readyState === 'complete') { | ||
resolve(); | ||
} else { | ||
const handler = function () { | ||
if (document.readyState === 'complete') { | ||
document.removeEventListener('readystatechange', handler, false); | ||
resolve(); | ||
} | ||
}; | ||
return new Promise(resolve => { | ||
if (isInteractive()) { | ||
resolve(); | ||
} else { | ||
const handler = function() { | ||
if (isInteractive()) { | ||
document.removeEventListener("readystatechange", handler, false); | ||
resolve(); | ||
} | ||
}; | ||
document.addEventListener('readystatechange', handler, false); | ||
} | ||
}); | ||
document.addEventListener("readystatechange", handler, false); | ||
} | ||
}); | ||
} | ||
function isInteractive() { | ||
return ( | ||
document.readyState === "complete" || document.readyState === "interactive" | ||
); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
150113
3856