Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple Atomic Task Definition
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
src
test
.gitignore
README.md
index.js
package.json
taskify.js

README.md

Taskify

This is a simple task execution helper that is heavily influenced from jake and grunt. It's kind of like jake but without the build goodies, and designed to work in the browser as well as node.

Example Usage

Define a task a:

task('a', function() {
    console.log('a'); 
});

Then define another task that relies on task a:

task('b', ['a'], function() {
    console.log('b'); 
});

Run task b:

task.run('b');

Which would generate the following output:

a
b

Asynchronous Behaviour

Specifying that a task handler behaves asynchronously is very similar to the way you would do this in a grunt task:

task('c', function() {
    // call the async method of the task (passed to the runner as this)
    var done = this.async(); 

    // when the task has been completed call done
    // the first argument is reserved for an error (if one occured)
    // and subsequent arguments will be placed on the context.results object
    setTimeout(function() {
        done();
    }, 1000);
});

Or a slightly less contrived example:

task('load-data', function() {
    fs.readFile(path.resolve('data.txt'), 'utf8', this.async()); 
});
Something went wrong with that request. Please try again.