- Lightweight (less than 250b minified and gzipped)
- No dependencies
- Supports IE 9+
Developed with ❤️ by GRRR
$ npm install @grrr/readyNote: depending on your setup additional configuration might be needed, since this package is published with untranspiled JavaScript.
Import into your main JavaScript file:
import { onDocumentLoaded, onDomReady } from "@grrr/ready";
onDomReady(() => {
// Execute main functions
});
onDocumentLoaded(() => {
// Execute functions after the document has fully loaded
});The onDomReady function:
- Will fire directly when Document.readyState
is not
loading(sointeractiveorcomplete). - Listens for both DOMContentLoaded and readystatechange if not yet ready.
The onDocumentLoaded function:
- Will fire directly when Document.readyState
is
complete. - Listens for readystatechange if not yet complete.