Currently, we have multiple scripts making use of window.onload. This presents some issues, mainly that you can only have one function assigned to window.onload by default.
I propose that we make use of the newer DomContentLoaded event. This will be fired once the DOM has been loaded up, but before assets like images have fully loaded - which is generally what we want.
It's simple enough:
window.addEventListener('DOMContentLoaded', (event) => {
console.log('DOM fully loaded and parsed');
});
Currently, we have multiple scripts making use of
window.onload
. This presents some issues, mainly that you can only have one function assigned towindow.onload
by default.I propose that we make use of the newer
DomContentLoaded
event. This will be fired once the DOM has been loaded up, but before assets like images have fully loaded - which is generally what we want.It's simple enough: