0.1.0 • Published 9 years ago

anticipant v0.1.0

Weekly downloads
4
License
ISC
Repository
github
Last release
9 years ago

anticipant

install

npm install anticipant

example

var Anticipant = require('anticipant');

anticipant = Anticipant.create(['task1', 'task2']);
anticipant.register('task3');

anticipant.then(function() {
	console.log('tasks 1, 2 and 3 done!')
});

anticipant.perform('task1');
anticipant.perform('task2');
anticipant.perform('task3');
// in console -> tasks 1, 2 and 3 done!

methods and fields

Anticipant.create(listOfTasks, resultFunction);

returned new anticipant instance.

Anticipant.register(taskName)

register new task, if task already exists reset done flag to false.

Anticipant.perform(taskName)

perform registered task. When all tasks are performed call result function.

Anticipant.then(taskName)

register result function.