Firefox Tomorrow

web api instance method

Performance: clearMarks() method

View on MDN ↗

Available in workers

The clearMarks() method removes all or specific PerformanceMark objects from the browser’s performance timeline.

Syntax

clearMarks()
clearMarks(name)

Parameters

  • name Optional
    • : A string representing the name of the PerformanceMark object. If this argument is omitted, all entries with an entryType 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:

// 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

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also