0.1.1 • Published 7 years ago

task-conveyor v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

task-conveyor

sequence task runner

Usage

Install the package

npm intall task-conveyor

Create the task runner

const createRunner = require('task-conveyor');
const runner = createRunner();

function* task1(before) {
  console.log(before);
  yield runner.next(null, 1);
}

function* task2(before) {
  console.log(before);
  yield runner.next(null, 2);
}

function* task3(before) {
  console.log(before);
}

function beforeEach() {
  console.log('>>>> write database');
}

const tasks = [ task1, task2, task3 ];
runner.init(tasks, beforeEach);
yield runner.next(null, 'init');