offloadFunctions.js #1

  • //
  • guest/
  • jen_bottom/
  • ember/
  • tutorial/
  • testapp/
  • node_modules/
  • workerpool/
  • examples/
  • offloadFunctions.js
  • View
  • Commits
  • Open Download .zip Download (480 B)
var workerpool = require('./../index');

// create a worker pool
var pool = workerpool.pool();

// create a static function
function add(a, b) {
  return a + b;
}

// offload execution of a function to the worker pool
pool.exec(add, [3, 4])
    .then(function (result) {
      console.log('result', result); // outputs 7
    })
    .catch(function (err) {
      console.error(err);
    })
    .then(function () {
      pool.terminate(); // terminate all workers when done
    });
# Change User Description Committed
#1 23539 jenbottom Adding the basic code for ember test appk, created with 'ember new' command