blob: a2e74f9eb5642ac675218cd73e8d1226083e2c6b [file]
// a simple worker
// load workerpool
var workerpool = require('../..');
// a deliberately inefficient implementation of the fibonacci sequence
function fibonacci(n) {
if (n < 2) return n;
return fibonacci(n - 2) + fibonacci(n - 1);
}
// create a worker and register public functions
workerpool.worker({
fibonacci: fibonacci
});