html-ready
v2.1.0
Published
The promise to ensure window/document is ready
Downloads
81
Readme
html-ready
The promise to ensure window/document is ready.
Install
Using npm:
$ npm install html-ready
Usage
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');
});
API
documentReady: Promise<Event | undefined>
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: Promise<Event | undefined>
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.