Created
July 3, 2014 12:51
-
-
Save rodolfo42/f43053f2d70fd83f424e to your computer and use it in GitHub Desktop.
Code to simulate registering onload callbacks with $( <function> ) but before jQuery is included in the page
This file contains 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
window.$ = (function () { | |
var cbs = []; | |
return function (callback) { | |
cbs.push(callback); | |
window.onload = function () { | |
while( !window.jQuery ); | |
cbs.map(function (c) { c(); }); | |
}; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment