Clumpy: Non-Blocking Loops in JavaScript

Clumpy Has Moved

It’s here now:

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.

    function () { i = 0; },
    function () { return i < 100000; },
    function () { i++; },
    function () {
        // statements


Clumpy emulates for,, 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.


Get Clumpy.


Read the official specs.

Version History

2013-04-14 (current version)
Changed interface to address design flaw.
Fixed bug reported by Vas Gábor.
Added init, interrupt and setNow methods.
Fixed a bug that prevented a Clumpy instance from being re-used.
First version as Clumpy.
© Thomas Peri