Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

1234567891011121314151617181920212223242526272829
  1. var abort = require('./abort.js')
  2. , async = require('./async.js')
  3. ;
  4. // API
  5. module.exports = terminator;
  6. /**
  7. * Terminates jobs in the attached state context
  8. *
  9. * @this AsyncKitState#
  10. * @param {function} callback - final callback to invoke after termination
  11. */
  12. function terminator(callback)
  13. {
  14. if (!Object.keys(this.jobs).length)
  15. {
  16. return;
  17. }
  18. // fast forward iteration index
  19. this.index = this.size;
  20. // abort jobs
  21. abort(this);
  22. // send back results we have so far
  23. async(callback)(null, this.results);
  24. }