workerpool
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -7,4 +7,4 @@ /** | ||
* | ||
* @version 2.2.2 | ||
* @date 2017-07-08 | ||
* @version 2.2.3 | ||
* @date 2017-08-19 | ||
* | ||
@@ -11,0 +11,0 @@ * @license |
@@ -7,4 +7,4 @@ /** | ||
* | ||
* @version 2.2.2 | ||
* @date 2017-07-08 | ||
* @version 2.2.3 | ||
* @date 2017-08-19 | ||
* | ||
@@ -11,0 +11,0 @@ * @license |
@@ -8,9 +8,14 @@ var workerpool = require('./../index'); | ||
pool.proxy().then(function (worker) { | ||
worker.asyncAdd(3, 4.1) | ||
.then(function (result) { | ||
console.log(result); | ||
pool.clear(); // clear all workers when done | ||
}); | ||
}); | ||
pool.proxy() | ||
.then(function (worker) { | ||
return worker.asyncAdd(3, 4.1); | ||
}) | ||
.then(function (result) { | ||
console.log(result); | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}) | ||
.then(function () { | ||
pool.clear(); // clear all workers when done | ||
}); |
@@ -10,4 +10,8 @@ var workerpool = require('./../index'); | ||
console.log('Result: ' + result); // outputs 55 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}) | ||
.then(function () { | ||
pool.clear(); // clear all workers when done | ||
}); |
@@ -15,4 +15,8 @@ var workerpool = require('./../index'); | ||
console.log('result', result); // outputs 7 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}) | ||
.then(function () { | ||
pool.clear(); // clear all workers when done | ||
}); |
@@ -10,8 +10,12 @@ var workerpool = require('./../index'); | ||
// execute a function via the proxy | ||
proxy.fibonacci(10) | ||
.then(function (result) { | ||
console.log('Result: ' + result); // outputs 55 | ||
pool.clear(); // clear all workers when done | ||
}); | ||
return proxy.fibonacci(10) | ||
}) | ||
.then(function (result) { | ||
console.log('Result: ' + result); // outputs 55 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}) | ||
.then(function () { | ||
pool.clear(); // clear all workers when done | ||
}); |
@@ -5,2 +5,7 @@ # workerpool history | ||
## 2017-08-19, version 2.2.3 | ||
- Updated all examples to neatly include `.catch(...)` callbacks. | ||
## 2017-07-08, version 2.2.2 | ||
@@ -7,0 +12,0 @@ |
{ | ||
"name": "workerpool", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "Offload tasks to a pool of workers on node.js and in the browser", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/josdejong/workerpool", |
@@ -77,3 +77,7 @@ # workerpool | ||
console.log('result', result); // outputs 7 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}) | ||
.then(function () { | ||
pool.clear(); // clear all workers when done | ||
@@ -119,3 +123,7 @@ }); | ||
console.log('Result: ' + result); // outputs 55 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}) | ||
.then(function () { | ||
pool.clear(); // clear all workers when done | ||
@@ -127,6 +135,12 @@ }); | ||
.then(function (worker) { | ||
worker.fibonacci(10) | ||
.then(function (result) { | ||
console.log('Result: ' + result); // outputs 55 | ||
}); | ||
return worker.fibonacci(10); | ||
}) | ||
.then(function (result) { | ||
console.log('Result: ' + result); // outputs 55 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}) | ||
.then(function () { | ||
pool.clear(); // clear all workers when done | ||
}); | ||
@@ -237,2 +251,5 @@ ``` | ||
console.log(result); // will output 6 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}); | ||
@@ -247,2 +264,5 @@ | ||
console.log(result); // will output 55 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}); | ||
@@ -253,6 +273,9 @@ | ||
.then(function (myWorker) { | ||
myWorker.fibonacci(10) | ||
.then(function (result) { | ||
console.log(result); // will output 55 | ||
}); | ||
return myWorker.fibonacci(10) | ||
}) | ||
.then(function (result) { | ||
console.log(result); // will output 55 | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}); | ||
@@ -259,0 +282,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
185511
3892
412