boot-tasks
Simple nodejs boot tasks manager. Executes a list of tasks, sync or async. That's all.
Usage example in CoffeeScript:
BootTasks = require 'boot-tasks' # Set final callback tasks = -> consolelog " [*] Server %s listening on %s:%d" servernodename argvhost argvport serverlisten argvportargvhost # Set sync mode taskssync # Add a task: redis taskstask -> redisClient = rediscreateClient configredisport configredishost configredisparams redisClienton 'ready'-> consolelog " [ ] redisClient ready" tasksdone # Run tasks tasksdo
Functions
Constructor
BootTasks = require 'boot-tasks'tasks = end
Optional end parameter as a function to call at the end.
.sync() and .async()
Set the execution mode. Default: sync
.on('done', callback) or .ondone(callback)
Function callback to call at the end.
.task(func)
Add a func function as a task.
.done()
Call at the end of every task to continue execution (only sync mode).
.do(context)
Process all the tasks. Optional context parameter for the tasks.
To-Do
- Dependency management
- done function as a parameter
- Emit events
- Tests