Perfect for situations that have no clear timeout, but only happen once.
Usage
untilTimeout(function(){
var elements = $('.foo select');
if(elements.length > 1){
doStuffWith(elements)
return true;
}
}, 100)
Code
function untilTimeout(callback, time){
var timer = setInterval(function(){
if(callback()){
clearInterval(timer);
}
}, time)
}
Hey Micha,
I’m not 100% sure but I guess you wanted to use setInterval in the untilTimeout function, right?
Sascha
Ops, completely right 😀