npm.io
0.1.0 • Published 10 years ago

anticipant

Licence
ISC
Version
0.1.0
Deps
0
Vulns
0
Weekly
0

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.

Keywords