The addEventListener
doesn't add events, I found that I should use
window.onload = function() {
// whole code here
}
but, when I try to use the functions that are within the window.onload
in the browser console, I can not, only the outer functions of it could be, I want to use them even if they were in it.
You can explicitly assign the functions to the window inside the handler.
window.addEventListener('DOMContentLoaded', () => {
window.someFn = () => {
// ...
};
someFn();
// you can also use someFn in the browser console
});