The promise to ensure window/document is ready.
MIT License
The promise to ensure window/document is ready.
Using npm:
$ npm install html-ready
import { documentReady, windowReady } from 'https://unpkg.com/html-ready';
documentReady.then(() => {
console.log('document DOMContentLoaded event is fired');
});
windowReady.then(() => {
console.log('window load event is fired');
});
documentReady
is a Promise
that is resolved if the HTML document has been loaded and parsed. If the hole page has not loaded, the timing is equivalent to the DOMContentLoaded
event of document.
windowReady
is a Promise
that is resolved if the hole page has been loaded. If the hole page has not been loaded, the timing is equivalent to the load
event of window.