Hello,
window.addEventListener( "DOMContentLoaded", function() {
//...
}, false);
I’d like to wrap this bit of code in a function:
var onReady = function()
{
window.addEventListener( "DOMContentLoaded", function() {
//...
}, false);
}
I’d like then to be able to use the ready as follow:
onReady(
//do stuff here
);
Obviously, this is not working. I’ve been searching for functions wrapper for addEventListener but didn’t come up with anythings satisfying. What would be the correct approach/syntax to wrap an eventListener in a function, and then use that function instead of the event listener?
Thanks in advance.