biscotto
biscotto copied to clipboard
Markdown descriptions are not rendered correctly
The following:
# Public: Our Task Class.
#
# Available configuration is documented in {::setConfig}.
#
# Available events:
#
# - `started()` - emitted when we start execution
# - `running()` - emitted when the method starts execution
# - `failed(err)` - emitted when execution exited with a failure
# - `passed()` - emitted when execution exited with a success
# - `completed(err, args...)` - emitted when execution exited, `args` are the result arguments from the method
# - `error(err)` - emtited if an unexpected error occurs without ourself
# - `done(err, args...)` - emitted when either execution completes (the `completed` event) or when an unexpected error occurs (the `error` event)
#
# Available internal statuses:
#
# - `null` - execution has not yet started
# - `'started'` - execution has begun
# - `'running'` - execution of our method has begun
# - `'failed'` - execution of our method has failed
# - `'passed'` - execution of our method has succeeded
# - `'destroyed'` - we've been destroyed and can no longer execute
#
# Examples
#
# task = require('taskgroup').Task.create('my synchronous task', function(){
# return 5
# }).done(console.log) // [null, 5]
#
# task = require('taskgroup').Task.create('my asynchronous task', function(complete){
# complete(null, 5)
# }).done(console.log) // [null, 5]
#
# task = require('taskgroup').Task.create('my task that errors', function(){
# var err = new Error('deliberate error')
# return err; // if asynchronous, can also do: complete(err)
# // thrown and uncaught errors are also caught thanks to domains, but that should be avoided
# // as it would put your app in an unknown state
# }).done(console.log) // [Error('deliberator error')]
Gets outputted as:
https://www.dropbox.com/s/p1khmx4lqvkegww/Screenshot%202015-02-02%2008.04.44.png?dl=0