MCPcopy
hub / github.com/angular/angular / getAndClearValues

Method getAndClearValues

packages/benchpress/src/metric/user_metric.ts:48–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 const names = Object.keys(this._userMetrics);
47
48 function getAndClearValues() {
49 Promise.all(names.map((name) => adapter.executeScript(`return window.${name}`))).then(
50 (values: any[]) => {
51 if (values.every((v) => typeof v === 'number')) {
52 Promise.all(names.map((name) => adapter.executeScript(`delete window.${name}`))).then(
53 (_: any[]) => {
54 const map: {[k: string]: any} = {};
55 for (let i = 0, n = names.length; i < n; i++) {
56 map[names[i]] = values[i];
57 }
58 resolve(map);
59 },
60 reject,
61 );
62 } else {
63 <any>setTimeout(getAndClearValues, 100);
64 }
65 },
66 reject,
67 );
68 }
69 getAndClearValues();
70 return promise;
71 }

Callers

nothing calls this directly

Calls 6

setTimeoutFunction · 0.85
mapMethod · 0.80
thenMethod · 0.65
resolveFunction · 0.50
allMethod · 0.45
executeScriptMethod · 0.45

Tested by

no test coverage detected