Is there a jQuery equivalent for a prototype?
I am looking for something that will delay script execution until all scripts on the page are executed.
Thanks!
PART II: Is there a way to see if there are other setTimeouts queues in the queue and defer execution until they light up? I see in the comments that sometimes setTimeout 0 or 1 does not matter, because it is unpredictable as to what will fire first.
Thanks again!
Refresh for reply
I found an error in the code that I used from the answer below. The slice call should work on 0, not 1, because in the Prototype kernel code it takes an additional parameter for the timeout (0.01). The final method will then be:
Function.prototype.deferFunc = function() { var __method = this, args = Array.prototype.slice.call(arguments, 0); return window.setTimeout(function() { return __method.apply(__method, args); }, 0.01); }
javascript jquery prototypejs
shmuel613
source share