chore: use map instead of plain object (#5068)
This commit is contained in:
parent
81d2600236
commit
06dbb72c73
@ -31,7 +31,7 @@ class LifecycleWatcher {
|
||||
else if (typeof waitUntil === 'string')
|
||||
waitUntil = [waitUntil];
|
||||
this._expectedLifecycle = waitUntil.map(value => {
|
||||
const protocolEvent = puppeteerToProtocolLifecycle[value];
|
||||
const protocolEvent = puppeteerToProtocolLifecycle.get(value);
|
||||
assert(protocolEvent, 'Unknown value for options.waitUntil: ' + value);
|
||||
return protocolEvent;
|
||||
});
|
||||
@ -188,11 +188,11 @@ class LifecycleWatcher {
|
||||
}
|
||||
}
|
||||
|
||||
const puppeteerToProtocolLifecycle = {
|
||||
'load': 'load',
|
||||
'domcontentloaded': 'DOMContentLoaded',
|
||||
'networkidle0': 'networkIdle',
|
||||
'networkidle2': 'networkAlmostIdle',
|
||||
};
|
||||
const puppeteerToProtocolLifecycle = new Map([
|
||||
['load', 'load'],
|
||||
['domcontentloaded', 'DOMContentLoaded'],
|
||||
['networkidle0', 'networkIdle'],
|
||||
['networkidle2', 'networkAlmostIdle'],
|
||||
]);
|
||||
|
||||
module.exports = {LifecycleWatcher};
|
||||
|
Loading…
Reference in New Issue
Block a user