From: Jérôme Benoit Date: Mon, 13 Sep 2021 19:23:28 +0000 (+0200) Subject: Constity and factor out last performance entry X-Git-Tag: v1.0.60~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=eb835fa84ced86641214bff490b3b5ce4332dbb4;p=e-mobility-charging-stations-simulator.git Constity and factor out last performance entry Signed-off-by: Jérôme Benoit --- 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'] }); }