JSPM

just-tasks

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q21248F
  • License MIT

Just a simple task runner interface

Package Exports

  • just-tasks

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (just-tasks) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

jsut-tasks

just-tasks is a very simple module to run 'tasks'. In essence it's just a rename of node's own EventEmitter interface, with semantics to match its function.

Installation

node install just-tasks

Usage

The module just renames the event emitter's default methods so you can use the following:

  • TaskRunner.task(name, function): Create a new task with the specified name (alias of EventEmitter's on)
  • TaskRunner.taskOnce(name, function): Create a new single use task with the specified name (alias of EventEmitter's once)
  • TaskRunner.run(name[, args]): Run the task with the specified name and the given arguments (alias of EventEmitter's emit)

Example

var TaskRunner = require('just-tasks');

// Create a new task
TaskRunner.task('print.welcome', function(name) {
    console.log('Welcome, %s!', name);
});

// Now, maybe from somewhere else (TaskRunner is a singleton), run the task
TaskRunner.run('print.welcome', 'Michael');

Of course you can also use callbacks as you're used to in node.

License

Copyright 2015 Michiel van der Velde.

This software is licensed under the MIT License.