Created
February 18, 2015 16:48
-
-
Save web20opensource/6c67368a2fdb0e712550 to your computer and use it in GitHub Desktop.
using the cross-browser event handler await until the load event happens and execute a callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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