Keep web perf marker names stable
This commit is contained in:
parent
797f96e7eb
commit
168e9928a5
1 changed files with 6 additions and 1 deletions
|
|
@ -40,7 +40,12 @@ function perfNow() {
|
||||||
|
|
||||||
function markPerf(name, detail) {
|
function markPerf(name, detail) {
|
||||||
const at = perfNow();
|
const at = perfNow();
|
||||||
const event = { name, at_ms: Math.round(at), ...(detail || {}) };
|
const safeDetail = { ...(detail || {}) };
|
||||||
|
if (Object.prototype.hasOwnProperty.call(safeDetail, "name")) {
|
||||||
|
safeDetail.stream_name = safeDetail.name;
|
||||||
|
delete safeDetail.name;
|
||||||
|
}
|
||||||
|
const event = { name, at_ms: Math.round(at), ...safeDetail };
|
||||||
perfState.marks[name] = event;
|
perfState.marks[name] = event;
|
||||||
perfState.events.push(event);
|
perfState.events.push(event);
|
||||||
if (window.performance && typeof window.performance.mark === "function") {
|
if (window.performance && typeof window.performance.mark === "function") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue