Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using the cross-browser event handler await until the load event happens and execute a callback
function attachEventApart(object, cB, event, onEvent){
if (object.addEventListener){
object.addEventListener(event, cB, false);
}
else if (window.attachEvent){
object.attachEvent(onEvent, cB);
}
else
object[onEvent] = cB;
}
var callBack = function(){
};
attachEventApart(window,callBack, "load", "onload");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.