Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

taskgroup

Package Overview
Dependencies
Maintainers
1
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

taskgroup - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

38

out/lib/taskgroup.js

@@ -25,2 +25,4 @@ // Generated by CoffeeScript 1.6.2

Task.prototype.args = null;
function Task() {

@@ -74,3 +76,7 @@ var args, fn, name;

process.nextTick(function() {
return ambi(_this.fn.bind(_this), complete);
var args, fn;
fn = _this.fn.bind(_this);
args = (_this.args || []).concat([complete]);
return ambi.apply(null, [fn].concat(__slice.call(args)));
});

@@ -145,17 +151,21 @@ return this;

});
this.on('run', function() {
var _ref;
return (_ref = _this.fn) != null ? _ref.call(_this, _this.addGroup, _this.addTask) : void 0;
});
process.nextTick(function() {
if (_this.fn && !_this.parent) {
return _this.run();
if (_this.fn) {
args = [_this.addGroup, _this.addTask];
_this.addTask(fn.bind(_this)).setConfig({
args: args,
includeInResults: false
});
if (!_this.parent) {
return _this.run();
}
}
});
this.on('item.complete', function() {
var args;
var args, item;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
_this.results.push(args);
item = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
if (item.includeInResults !== false) {
_this.results.push(args);
}
if (args[0]) {

@@ -197,3 +207,3 @@ _this.err = args[0];

args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return me.emit.apply(me, ["item." + this.event].concat(__slice.call(args)));
return me.emit.apply(me, ["item." + this.event, item].concat(__slice.call(args)));
});

@@ -232,3 +242,3 @@ this.emit('add', item);

args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return me.emit.apply(me, ["task." + this.event].concat(__slice.call(args)));
return me.emit.apply(me, ["task." + this.event, task].concat(__slice.call(args)));
});

@@ -263,3 +273,3 @@ return this.addItem(task);

args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
return me.emit.apply(me, ["group." + this.event].concat(__slice.call(args)));
return me.emit.apply(me, ["group." + this.event, group].concat(__slice.call(args)));
});

@@ -266,0 +276,0 @@ return this.addItem(group);

{
"name": "taskgroup",
"version": "3.0.0",
"version": "3.1.0",
"description": "Group together synchronous and asynchronous tasks and execute them with support for concurrency, naming, and nesting.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/taskgroup",

@@ -109,3 +109,3 @@ # Task Group

- `name`, no default - allows us to assign a name to the group, useful for debugging
- `fn(addGroup,addTask)`, no default - allows us to use an inline and self-executing style for defining groups, useful for nesting
- `fn(addGroup,addTask,complete?)`, no default - allows us to use an inline and self-executing style for defining groups, useful for nesting
- `concurrency`, defaults to `1` - how many items shall we allow to be run at the same time, set to `0` to allow unlimited

@@ -117,8 +117,8 @@ - `pauseOnError`, defaults to `true` - if an error occurs in one of our items, should we stop executing any remaining items?

- `complete(err, results)` - fired when all our items have completed
- `task.run()` - fired just before a task item executes
- `task.complete(err, args...)` - fired when a task item has completed
- `group.run()` - fired just before a group item executes
- `group.complete(err, results)` - fired when a group item has completed
- `item.run()` - fired just before an item executes (fired for both sub-tasks and sub-groups)
- `item.complete(err, args...)` - fired when an item has completed (fired for both sub-task and sub-groups)
- `task.run(task)` - fired just before a task item executes
- `task.complete(task, err, args...)` - fired when a task item has completed
- `group.run(group)` - fired just before a group item executes
- `group.complete(group, err, results)` - fired when a group item has completed
- `item.run(item)` - fired just before an item executes (fired for both sub-tasks and sub-groups)
- `item.complete(item, err, args...)` - fired when an item has completed (fired for both sub-task and sub-groups)

@@ -139,2 +139,3 @@

- `fn(complete?)`, no default - must be set at some point, it is the function to execute for the task, if it is asynchronous it should use the completion callback provided
- `args`, no default - an array of arguments that you would like to precede the completion callback when executing `fn`
- Available events:

@@ -141,0 +142,0 @@ - `run()` - fired just before we execute the task

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc