puppeteer/lib/TaskQueue.js
JoelEinbinder ffe5b63dba chore: refactor Browser.js into seperate files (#2097)
This patch splits Browser.js into multiple separate files.
2018-02-26 12:10:06 -08:00

17 lines
301 B
JavaScript

class TaskQueue {
constructor() {
this._chain = Promise.resolve();
}
/**
* @param {function()} task
* @return {!Promise}
*/
postTask(task) {
const result = this._chain.then(task);
this._chain = result.catch(() => {});
return result;
}
}
module.exports = TaskQueue;