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')
|
else if (typeof waitUntil === 'string')
|
||||||
waitUntil = [waitUntil];
|
waitUntil = [waitUntil];
|
||||||
this._expectedLifecycle = waitUntil.map(value => {
|
this._expectedLifecycle = waitUntil.map(value => {
|
||||||
const protocolEvent = puppeteerToProtocolLifecycle[value];
|
const protocolEvent = puppeteerToProtocolLifecycle.get(value);
|
||||||
assert(protocolEvent, 'Unknown value for options.waitUntil: ' + value);
|
assert(protocolEvent, 'Unknown value for options.waitUntil: ' + value);
|
||||||
return protocolEvent;
|
return protocolEvent;
|
||||||
});
|
});
|
||||||
@ -188,11 +188,11 @@ class LifecycleWatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const puppeteerToProtocolLifecycle = {
|
const puppeteerToProtocolLifecycle = new Map([
|
||||||
'load': 'load',
|
['load', 'load'],
|
||||||
'domcontentloaded': 'DOMContentLoaded',
|
['domcontentloaded', 'DOMContentLoaded'],
|
||||||
'networkidle0': 'networkIdle',
|
['networkidle0', 'networkIdle'],
|
||||||
'networkidle2': 'networkAlmostIdle',
|
['networkidle2', 'networkAlmostIdle'],
|
||||||
};
|
]);
|
||||||
|
|
||||||
module.exports = {LifecycleWatcher};
|
module.exports = {LifecycleWatcher};
|
||||||
|
Loading…
Reference in New Issue
Block a user