From eb835fa84ced86641214bff490b3b5ce4332dbb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 13 Sep 2021 21:23:28 +0200 Subject: [PATCH] Constity and factor out last performance entry MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/performance/PerformanceStatistics.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index bae6fa48..d594f138 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -98,8 +98,9 @@ export default class PerformanceStatistics { private initializePerformanceObserver(): void { this.performanceObserver = new PerformanceObserver((list) => { - this.addPerformanceEntryToStatistics(list.getEntries()[0]); - logger.debug(`${this.logPrefix()} '${list.getEntries()[0].name}' performance entry: %j`, list.getEntries()[0]); + const lastPerformanceEntry = list.getEntries()[0]; + this.addPerformanceEntryToStatistics(lastPerformanceEntry); + logger.debug(`${this.logPrefix()} '${lastPerformanceEntry.name}' performance entry: %j`, lastPerformanceEntry); }); this.performanceObserver.observe({ entryTypes: ['measure'] }); } -- 2.34.1