Provides a task manager for organizing and scheduling asynchronous operations
Taskman is a node.js library for managing (possibly) asynchronous operations. This library strives to be different from other asynchronous operations managers by focusing on the relationships between tasks. Tasks that have no dependencies are run first, and tasks that do have dependencies are run as soon as their dependencies have completed.
To use a task manager, you must first instantiate an instance.
var Task = require"node-taskman"task = ;
Then you add your tasks in the form of functions. The task function should call either the finish or cancel method passed in to it once the task has completed/errored. This will trigger any dependents this task has.
var task1 = taskaddconsole.log"I am a task";setTimeoutfinish;1000;;
Next, specify the relationships between the different tasks.
taskcreateDependencytask3 task1 task2;
Finally, run and enjoy!
You can instantiate as many taskmans as you want, and can even nest taskmans inside of each other. See
examples/ for other interesting ways of using taskman.
npm install taskman
Adds a task to the manager.
taskmanaddtaskID dependencies task
The task ID of the newly created task.
Cancels the run in progress and calls the cancel callback supplied to Taskman#run, if available.
Clears all of the dependencies for the supplied targets
Creates a dependency between two or more tasks
Resets the task so that it can be used again. All registered tasks and dependencies are discarded.
Runs the scheduled tasks. Any changes to the dependencies after this method is called are ignored.
taskmanrunserializeTasksFlag completion cancel
Automatically creates a dependency between every task such that the next task does not run until the task before it has completed. Any tasks added after this method is called are not serialized.
Copyright 2012-2013 Bryan Hughes firstname.lastname@example.org
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.