AsyncFn
Description
This is one-method library, which main purpose is ability to run provided to this method asynchronous functions in a queue one by one. Please notice, that all provided functions should return a promise and they should be asynchronous. Support for simple functions is not yet implemented, but planned.
Example
Here's just a spec example.
it 'calls callbacks in a queue one by one' asyncFn1 = sinonspy=> dfd = new $Deferred setTimeout -> dfdresolve 700 dfdpromise asyncFn2 = sinonspy=> dfd = new $Deferred setTimeout -> dfdresolve 300 dfdpromise asyncFn3 = sinonspy=> dfd = new $Deferred setTimeout -> dfdresolve 100 dfdpromise AsyncFnaddToCallQueue asyncFn1 AsyncFnaddToCallQueue asyncFn2 AsyncFnaddToCallQueue asyncFn3 expectasyncFn2tobenotcalled expectasyncFn3tobenotcalled setTimeout -> expectasyncFn1tobecalledOnce expectasyncFn2tobecalledOnce expectasyncFn3tobecalledOnce expectasyncFn1tobecalledBefore asyncFn2 expectasyncFn2tobecalledBefore asyncFn3 done 1500