chore: refactor Browser.js into seperate files (#2097)

This patch splits Browser.js into multiple separate files.
This commit is contained in:
JoelEinbinder
2018-02-26 12:10:06 -08:00
committed by Andrey Lushnikov
parent 8578283e11
commit ffe5b63dba
5 changed files with 122 additions and 107 deletions

17
lib/TaskQueue.js Normal file
View File

@@ -0,0 +1,17 @@
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;