mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: refactor Browser.js into seperate files (#2097)
This patch splits Browser.js into multiple separate files.
This commit is contained in:
committed by
Andrey Lushnikov
parent
8578283e11
commit
ffe5b63dba
17
lib/TaskQueue.js
Normal file
17
lib/TaskQueue.js
Normal 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;
|
||||
Reference in New Issue
Block a user