1.0.0 • Published 8 years ago

taskflows v1.0.0

Weekly downloads
6
License
-
Repository
github
Last release
8 years ago

TaskFlows

Scalable Promise / semaphore manager & task sequencer

Minimal Examples

As simple semaphore

        var s = new taskflow().then(callback);
        rows.forEach(function ( row ) {
                    s.wait();
                    doSomething(row, s.release);
                });
        s.run();

As task flow

        var scope = {rows : []},
            flow  = new taskflow(
                [
                    ( scope, flow )=> {
                        return [async1, async2, async3]
                    },
                    ( scope, flow )=> {

                        scope.rows.forEach(function ( row ) {
                            flow.wait();
                            doSomething(row, flow.release);
                        });

                    }
                ],
                scope
            ).then(callback).run();