How to repeat a single callback on interval?
Compact syntax with timing methods:
1
$.repeat(interval, function(){ … });
Compare this to the old way with more syntactic fluff:
1
setInterval(function(){ … }, interval);
Similar patterns with callbacks
- How to
invoke a single function after a timeout?$.wait(timeout, function(){ … });
- How to
invoke a callback at some specific point in the timeline?$some.timingStuff().then(callback).doMore();
- How to
concatenate function calls with timeouts?$.wait(first-timeout, function(){ … }) .wait(second-timeout, function(){ … }) .wait(third-timeout, function(){ … });
- How to
invoke a function on each element without timing?$('.many').each(function(i,elem){ … });
Similar patterns with intervals
- How to
repeat actions on interval with an open loop?$('.some').repeat(interval).doThis().overAndOver();
- How to
repeat actions on interval with a closed loop?$('.some').repeat(interval).doThis().until(false);
- How to
repeat actions in an open interval loop with immediate first run?$('.some').repeat(interval,true).doThis().overAndOver();
- How to
repeat actions in a closed interval loop with immediate first run?$('.some').repeat(interval,true).doThis().until(false);
- How to
repeat on interval a given number of times?$('.some').repeat(interval).doThis().until(count);
Similar patterns with open loops
- How to
repeat actions on interval with an open loop?$('.some').repeat(interval).doThis().overAndOver();
- How to
repeat actions in an open interval loop with immediate first run?$('.some').repeat(interval,true).doThis().overAndOver();
- How to
collect primitive values from each element into an array-like object?var values = $('.some').each().attr(name);
- How to
collect primitive values from each element into a native array using an open each-loop?var valueArray = $($('.some').each().attr(name)).get();
Similar patterns with sequential loops
- How to
repeat actions on interval with an open loop?$('.some').repeat(interval).doThis().overAndOver();
- How to
repeat actions on interval with a closed loop?$('.some').repeat(interval).doThis().until(false);
- How to
repeat actions in an open interval loop with immediate first run?$('.some').repeat(interval,true).doThis().overAndOver();
- How to
repeat actions in a closed interval loop with immediate first run?$('.some').repeat(interval,true).doThis().until(false);
- How to
repeat actions a given number of times?$('.some').repeat().doThis().jQueryStuff().until(count);
- How to
repeat on interval a given number of times?$('.some').repeat(interval).doThis().until(count);
- How to
wait for some event on each element in the right sequence?$('.many').each($).wait(event).all().doSome().jQueryStuff();