Skip to content

Commit 701abfe

Browse files
Adding console.timestamps
1 parent b95162d commit 701abfe

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

photo-gallery/gallery.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,8 @@ function populateGallery(images) {
312312
}
313313
},
314314
});
315+
316+
console.timeStamp("Photo created", imageCreationStart, undefined, "Console timestamp track", customPerformanceTrackGroupName, "tertiary-dark");
315317
});
316318
}
317319

@@ -424,15 +426,6 @@ addEventListener('keydown', e => {
424426
});
425427

426428
function loadPhoto(fileName) {
427-
// Take a start timestamp
428-
const start = performance.now();
429-
// Measure duration from start to now
430-
console.timeStamp("measure 1", start, undefined, "My Track", "My Group", "primary-light");
431-
// Take an end timestamp
432-
const end = performance.now();
433-
// Measure duration from start to end
434-
console.timeStamp("measure 2", start, end, "My Track", "My Group", "secondary-dark");
435-
436429
const loadStartTime = performance.now();
437430
const perfMeasureDescription = `Loading photo: ${fileName}`;
438431

@@ -457,7 +450,7 @@ function loadPhoto(fileName) {
457450
},
458451
});
459452

460-
performance.mark("Photo Loaded", {
453+
performance.mark("Photo loaded", {
461454
detail: {
462455
devtools: {
463456
dataType: "marker",
@@ -470,6 +463,8 @@ function loadPhoto(fileName) {
470463
}
471464
});
472465

466+
console.timeStamp("Photo loaded", loadStartTime, undefined, "Console timestamp track", customPerformanceTrackGroupName, "primary-light");
467+
473468
resolve(imageEl);
474469
}, { once: true });
475470
});

0 commit comments

Comments
 (0)