MCPcopy Index your code
hub / github.com/nodejs/node / constructor

Method constructor

lib/internal/perf/usertiming.js:70–93  ·  view source on GitHub ↗
(name, options = undefined)

Source from the content-addressed store, hash-verified

68
69class PerformanceMark extends PerformanceEntry {
70 constructor(name, options = undefined) {
71 if (arguments.length === 0) {
72 throw new ERR_MISSING_ARGS('name');
73 }
74 name = `${name}`;
75 if (nodeTimingReadOnlyAttributes.has(name))
76 throw new ERR_INVALID_ARG_VALUE('name', name);
77 if (options != null) {
78 validateObject(options, 'options');
79 }
80 const startTime = options?.startTime ?? now();
81 validateNumber(startTime, 'startTime');
82 if (startTime < 0)
83 throw new ERR_PERFORMANCE_INVALID_TIMESTAMP(startTime);
84 markTimings.set(name, startTime);
85
86 let detail = options?.detail;
87 detail = detail != null ?
88 structuredClone(detail) :
89 null;
90
91 super(kSkipThrow, name, 'mark', startTime, 0);
92 this[kDetail] = detail;
93 }
94
95 get detail() {
96 validateThisInternalField(this, kDetail, 'PerformanceMark');

Callers

nothing calls this directly

Calls 4

structuredCloneFunction · 0.85
hasMethod · 0.65
nowFunction · 0.50
setMethod · 0.45

Tested by

no test coverage detected