simple-tasks
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -42,2 +42,3 @@ // Generated by CoffeeScript 1.8.0 | ||
Queue.prototype.handleWorkerMessage = function(result) { | ||
var _base, _base1; | ||
if (result.status === 'stopped') { | ||
@@ -50,5 +51,9 @@ return typeof this.stopCallback === "function" ? this.stopCallback() : void 0; | ||
if (result.status === 'success') { | ||
this.tasks[0].callback(null, result.result); | ||
if (typeof (_base = this.tasks[0]).callback === "function") { | ||
_base.callback(null, result.result); | ||
} | ||
} else { | ||
this.tasks[0].callback(result.error, null); | ||
if (typeof (_base1 = this.tasks[0]).callback === "function") { | ||
_base1.callback(result.error, null); | ||
} | ||
} | ||
@@ -55,0 +60,0 @@ this.tasks.shift(); |
{ | ||
"name": "simple-tasks", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Easy way to dispatch your functions to a separate process making them truly async", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -16,5 +16,5 @@ # node-simple-tasks | ||
*method* **push**( `function`, `arg1`, `arg2`, ...) | ||
*method* **push**( `function`, `arg1`, `arg2`, ..., `callback`) | ||
Schedules `function` to be called with `arg1`, `arg2`, ... arguments in worker process context. | ||
Schedules `function` to be called with `arg1`, `arg2`, ... arguments in worker process context. The `callback` function will be called when task is finished. `callback` can be null. | ||
@@ -28,3 +28,3 @@ | ||
console.log("This will be executed by a separate process!"); | ||
}); | ||
}, null); | ||
``` | ||
@@ -43,3 +43,5 @@ If the function which will run in worker process calls any other user functions, they may be passed to it as arguments. The only limitation is that all arguments must be self-contained. | ||
tasks.push(doStuff, printArgument); | ||
tasks.push(doStuff, printArgument, function() { | ||
console.log('task finished'); | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
7895
101
45