perf_hooks: use for...of
PR-URL: https://github.com/nodejs/node/pull/31049 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
904a81d235
commit
bf6b39dc9f
@ -320,12 +320,11 @@ class PerformanceObserver extends AsyncResource {
|
|||||||
disconnect() {
|
disconnect() {
|
||||||
const observerCountsGC = observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC];
|
const observerCountsGC = observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC];
|
||||||
const types = this[kTypes];
|
const types = this[kTypes];
|
||||||
const keys = ObjectKeys(types);
|
for (const key of ObjectKeys(types)) {
|
||||||
for (var n = 0; n < keys.length; n++) {
|
const item = types[key];
|
||||||
const item = types[keys[n]];
|
|
||||||
if (item) {
|
if (item) {
|
||||||
L.remove(item);
|
L.remove(item);
|
||||||
observerCounts[keys[n]]--;
|
observerCounts[key]--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this[kTypes] = {};
|
this[kTypes] = {};
|
||||||
@ -351,8 +350,7 @@ class PerformanceObserver extends AsyncResource {
|
|||||||
this[kBuffer][kEntries] = [];
|
this[kBuffer][kEntries] = [];
|
||||||
L.init(this[kBuffer][kEntries]);
|
L.init(this[kBuffer][kEntries]);
|
||||||
this[kBuffering] = Boolean(options.buffered);
|
this[kBuffering] = Boolean(options.buffered);
|
||||||
for (var n = 0; n < entryTypes.length; n++) {
|
for (const entryType of entryTypes) {
|
||||||
const entryType = entryTypes[n];
|
|
||||||
const list = getObserversList(entryType);
|
const list = getObserversList(entryType);
|
||||||
if (this[kTypes][entryType]) continue;
|
if (this[kTypes][entryType]) continue;
|
||||||
const item = { obs: this };
|
const item = { obs: this };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user