task-queue
Advanced tools
Comparing version 0.0.5 to 0.0.6
11
index.js
@@ -10,3 +10,3 @@ /** | ||
_opts.concurrency = this._opts.concurrency | 1; | ||
_opts.concurrency = _opts.concurrency | 1; | ||
@@ -18,8 +18,10 @@ var _exec = function() { | ||
var popped = _array.pop(); | ||
if (popped) | ||
if (popped) { | ||
setImmediate(function () { | ||
popped.method.apply(popped.context | null, popped.args | null); | ||
popped.method.apply(popped.context != undefined ? popped.context : null, | ||
popped.args != undefined ? popped.args : null); | ||
actual_concurrency--; | ||
if (actual_concurrency == 0) _exec(); | ||
}); | ||
} | ||
} | ||
@@ -34,5 +36,6 @@ } | ||
push: function(fn, opts){ // support fn(args) arguments | ||
var task = opts | {}; | ||
var task = opts != undefined ? opts : {}; | ||
task.method = fn; | ||
_array.push(task); | ||
console.log(task); | ||
_exec(); | ||
@@ -39,0 +42,0 @@ }, |
{ | ||
"author" : "Roberto Sales <robertosalesc@dcc.ufba.br>", | ||
"name": "task-queue", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "async single worker tasks queue that supports concurrency, priority and provide simple interface for passing task arguments", | ||
@@ -6,0 +6,0 @@ "keywords": ["task", "queue", "worker", "concurrency", "async", "priority"], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2402
57