0.0.3 • Published 10 years ago

node-tasks v0.0.3

Weekly downloads
2
License
-
Repository
github
Last release
10 years ago

node-tasks

A very handy nodejs async lib to handle some named limited parallel works.

Tasks = require "node-tasks"
tasks = new Tasks("initDb","setupSocket","loadCustomConfig");
tasks.on "done",() => 
  console.log "done!"
  console.log tasks.hasDone  # => true
  task.done("loadCustomConfig") # => nothing happend we won't fire `done` twice unless you reset it
  # you can reset it if you want
  tasks.reset()
  console.log tasks.hasDone # => false
  
setTimeout (() ->
  tasks.done "initDb"
  ),100

setTimeout (() ->
  tasks.done "setupSocket"
  ),100

setTimeout (() ->
  tasks.done "loadCustomConfig"
  ),100
try 
  tasks.done "invalid Task"
catch e
  console.log e  # => unknown task invalid Task
0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

11 years ago

0.0.0

11 years ago