Performance: clearMarks() method
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2015.
Note: This feature is available in Web Workers.
The clearMarks()
method removes all or specific PerformanceMark
objects from the browser's performance timeline.
Syntax
js
clearMarks()
clearMarks(name)
Parameters
name
Optional-
A string representing the
name
of thePerformanceMark
object. If this argument is omitted, all entries with anentryType
of"mark"
will be removed.
Return value
None (undefined
).
Examples
Removing markers
To clean up all performance marks, or just specific entries, use the clearMarks()
method like this:
js
// Create a bunch of marks
performance.mark("login-started");
performance.mark("login-started");
performance.mark("login-finished");
performance.mark("form-sent");
performance.mark("video-loaded");
performance.mark("video-loaded");
performance.getEntriesByType("mark").length; // 6
// Delete just the "login-started" mark entries
performance.clearMarks("login-started");
performance.getEntriesByType("mark").length; // 4
// Delete all of the mark entries
performance.clearMarks();
performance.getEntriesByType("mark").length; // 0
Specifications
Specification |
---|
User Timing # dom-performance-clearmarks |
Browser compatibility
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
clearMarks |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Requires a vendor prefix or different name for use.
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.