Skip to content

Commit

Permalink
chore: use map instead of plain object (#5068)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Oct 23, 2019
1 parent 81d2600 commit 06dbb72
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/LifecycleWatcher.js
Expand Up @@ -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;
});
Expand Down Expand Up @@ -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};

0 comments on commit 06dbb72

Please sign in to comment.