Constity and factor out last performance entry
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 13 Sep 2021 19:23:28 +0000 (21:23 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 13 Sep 2021 19:23:28 +0000 (21:23 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/performance/PerformanceStatistics.ts

index bae6fa48e37a8f89bd18fdf7e617a36d76b9271d..d594f13897cc3d1d3f9baa7537f12373c5c64083 100644 (file)
@@ -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'] });
   }