Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
terminator.js30 linesDownload Raw Back to lib
1var abort = require('./abort.js')2  , async = require('./async.js')3  ;4 5// API6module.exports = terminator;7 8/**9 * Terminates jobs in the attached state context10 *11 * @this  AsyncKitState#12 * @param {function} callback - final callback to invoke after termination13 */14function terminator(callback)15{16  if (!Object.keys(this.jobs).length)17  {18    return;19  }20 21  // fast forward iteration index22  this.index = this.size;23 24  // abort jobs25  abort(this);26 27  // send back results we have so far28  async(callback)(null, this.results);29}30 
codekingpro/portable-devtools · Team Ai