DOM ready & document loaded JavaScript listeners
$ npm install @grrr/ready
Note: 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:
loading
(so interactive
or complete
).The onDocumentLoaded
function:
complete
.