Skip to content

Instantly share code, notes, and snippets.

@coderaiser
Last active October 11, 2015 21:38
Show Gist options
  • Save coderaiser/3923522 to your computer and use it in GitHub Desktop.
Save coderaiser/3923522 to your computer and use it in GitHub Desktop.
anyLoadOnload speed results
/*
spead result
1198
1162
1189
*/
DOM.anyLoadOnload = function(pParams_a, pFunc){
if( this.isArray(pParams_a) ) {
var lParam = pParams_a.pop();
if(lParam && !lParam.func){
lParam.func = function(){
DOM.anyLoadOnload(pParams_a, pFunc);
};
DOM.anyload(lParam);
}else
Util.exec(pFunc);
}
}
/*
spead result
2179
1956
2036
*/
DOM.anyLoadOnload = function(pParams_a, pFunc){
var i = 0;
function lFunc(pCount){
var lParam = pParams_a[pCount];
if(lParam && !lParam.func){
lParam.func = function(){
lFunc(++i);
};
DOM.anyload(lParam);
}else
Util.exec(pFunc)
};
if( Util.isArray(pParams_a) ) {
lFunc(i);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment