blob: 8cfb7a726e1ebbb7b1a3424d4171dda5640dd77e [file] [log] [blame]
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};