example.js 209 B

123456789101112
  1. 'use strict'
  2. var queue = require('./')(worker, 1)
  3. queue.push(42, function (err, result) {
  4. if (err) { throw err }
  5. console.log('the result is', result)
  6. })
  7. function worker (arg, cb) {
  8. cb(null, 42 * 2)
  9. }