CKTIS / JavaScript
Performance.getEntriesByName — retrieving entries by name
Performance.getEntriesByName retrieves current performance timeline entries with a specified name and optional type. It returns an array rather than a single entry and does not track future events.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
performance.getEntriesByName(name)
performance.getEntriesByName(name, type)Performance.getEntriesByName is a Web API method called as performance.getEntriesByName(name, type). Required name identifies the entry name; optional type, such as "mark", narrows the result. Omitting it filters only by name. This is not a feature of ECMAScript itself.
The result is an array of PerformanceEntry objects ordered by ascending startTime. Multiple entries can share a name; no matches produces []. The method reads entries present when called rather than subscribing to subsequent entries. Use PerformanceObserver for notifications.
Not every entry type is accessible through this method: types including "element", "event", "largest-contentful-paint", "layout-shift", and "longtask" require PerformanceObserver. MDN marks the method as widely available across browsers since September 2017; it is also available in Web Workers. Having Node 24 in a repository does not establish browser support.
The example creates two marks sharing one name and retrieves them with the "mark" filter. It deliberately avoids printing variable timestamps. It clears marks with the demonstration name before running and in finally, leaving other names untouched.
Examples
(() => {
const name = "cktis-getEntriesByName-demo";
performance.clearMarks(name);
try {
performance.mark(name);
performance.mark(name);
const entries = performance.getEntriesByName(name, "mark");
console.log(entries.length);
console.log(entries.map(entry => entry.entryType).join(","));
console.log(entries.every(entry => entry.name === name));
} finally {
performance.clearMarks(name);
}
})();Result
2 mark,mark true
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.