UNPKG

ember-app-scheduler

Version:

Ember addon to schedule work at different phases of app life cycle.

22 lines (18 loc) 472 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.clear(); // clear all workers when done });