Concurrency
This package provides dependency mangement for child procecesses and callbacks. It also allows you to create custom tasks that may then be added as a dependency elsewhere.
Installing
npm install concurrency
Example Usage
var concurrency = ;var Callback = concurrencyCallback;var Process = concurrencyProcess; var find = command:"find" args:"/bin";var find2 = command:"find" args:"/usr/bin"; var callback = { var i = ; //let's write them to stdout for fun... findstdout; find2stdout; //we better give the pipes enough time to drain ;) ;}; var ls = command:"ls"; find;find;find2;find2; ls; ls; ls;
Custom Tasks
The source for Callback says it best:
var Task = ; moduleexports = Callback;Callbackprototype=;Callbackprototypeconstructor=Callback;Callbackprototypeyield=null; /** * @constructor * @param {function(function(value), ...[Task])} fn Receives a callback and the * followed [Task[s]]. The value given to the callback becomes the yield on the * Callback and when called signals the 'complete' event on the Callback. * @returns */{ this; var task = this; var _yield=null; var notRun=true; iftypeof fn !== 'function' throw "fn must be a function"; Object; task;}
License
Copyright 2013 Joseph Spencer.
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
http://www.apache.org/licenses/LICENSE-2.0
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.