It’s here now: https://thomasperi.github.io/clumpyjs/
Clumpy (formerly Asynchronizer) provides a way of modeling incremental asynchronous processes after traditional loops, letting you focus on your program without having to manage the code that chops it up.
clumpy.for_loop(
function () { i = 0; },
function () { return i < 100000; },
function () { i++; },
function () {
// statements
}
);
Clumpy emulates for
, for...in
, while
, do...while
, continue
, and break
. These can be labeled, nested, chained, and interspersed with non-loop operations. Execution can be paused and resumed in various ways.
It creates a managed chain of timeouts, promising to perform all the iterations in the proper order. The number of iterations performed in each single “clump” of execution is adjusted transparently to suit the speed of the computer executing the code.
Continue on to the usage guide for a quick tutorial.
Read the official specs.
init
, interrupt
and setNow
methods.