Created
May 8, 2010 23:40
-
-
Save getify/394836 to your computer and use it in GitHub Desktop.
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
// LABjs.jquery.ready -- adds .ready() to $LAB api for wrapping a .wait() and a $(document).ready(...) together | |
// v0.0.1 (c) Kyle Simpson | |
// MIT License | |
(function(global){ | |
var oDOC = global.document; | |
if (!global.$LAB || !global.jQuery) return; // only adapt LABjs if LABjs exists and jQuery is present | |
function wrap_API(obj) { | |
var ret = { | |
setOptions:function(){ | |
return wrap_API(obj.setOptions.apply(this,arguments)); | |
}, | |
script:function(){ | |
return wrap_API(obj.script.apply(this,arguments)); | |
}, | |
wait:function(){ | |
return wrap_API(obj.wait.apply(this,arguments)); | |
}, | |
ready:function(fn){ | |
return wrap_API(obj.wait(function(){ | |
global.jQuery(oDOC).ready(fn); | |
})); | |
} | |
}; | |
if (obj.setGlobalDefaults) ret.setGlobalDefaults = obj.setGlobalDefaults; | |
ret.block = ret.wait; | |
return ret; | |
} | |
global.$LAB = wrap_API(global.$LAB); | |
})(window); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment