The Performance interface provides access to performance-related information for the current page.

MDN Reference

interface Performance {
    eventCounts: EventCounts;
    navigation: PerformanceNavigation;
    onresourcetimingbufferfull: ((this: Performance, ev: Event) => any) | null;
    timeOrigin: number;
    timing: PerformanceTiming;
    addEventListener<K extends "resourcetimingbufferfull">(
        type: K,
        listener: (this: Performance, ev: PerformanceEventMap[K]) => any,
        options?: boolean | AddEventListenerOptions,
    ): void;
    addEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | AddEventListenerOptions,
    ): void;
    clearMarks(markName?: string): void;
    clearMeasures(measureName?: string): void;
    clearResourceTimings(): void;
    dispatchEvent(event: Event): boolean;
    getEntries(): PerformanceEntryList;
    getEntriesByName(name: string, type?: string): PerformanceEntryList;
    getEntriesByType(type: string): PerformanceEntryList;
    mark(
        markName: string,
        markOptions?: PerformanceMarkOptions,
    ): PerformanceMark;
    measure(
        measureName: string,
        startOrMeasureOptions?: string | PerformanceMeasureOptions,
        endMark?: string,
    ): PerformanceMeasure;
    now(): number;
    removeEventListener<K extends "resourcetimingbufferfull">(
        type: K,
        listener: (this: Performance, ev: PerformanceEventMap[K]) => any,
        options?: boolean | EventListenerOptions,
    ): void;
    removeEventListener(
        type: string,
        listener: EventListenerOrEventListenerObject,
        options?: boolean | EventListenerOptions,
    ): void;
    setResourceTimingBufferSize(maxSize: number): void;
    toJSON(): any;
}
Hierarchy
  • EventTarget
    • Performance
Index

Properties

eventCounts: EventCounts

The read-only performance.eventCounts property is an EventCounts map containing the number of events which have been dispatched per event type.

MDN Reference

The legacy Performance.navigation read-only property returns a PerformanceNavigation object representing the type of navigation that occurs in the given browsing context, such as the number of redirections needed to fetch the resource.

MDN Reference

onresourcetimingbufferfull: ((this: Performance, ev: Event) => any) | null
timeOrigin: number

The timeOrigin read-only property of the Performance interface returns the high resolution timestamp that is used as the baseline for performance-related timestamps.

MDN Reference

The legacy Performance.timing read-only property returns a PerformanceTiming object containing latency-related performance information.

MDN Reference

Methods

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

    MDN Reference

    Parameters

    • OptionalmarkName: string

    Returns void

  • The clearMeasures() method removes all or specific PerformanceMeasure objects from the browser's performance timeline.

    MDN Reference

    Parameters

    • OptionalmeasureName: string

    Returns void

  • The clearResourceTimings() method removes all performance entries with an PerformanceEntry.entryType of 'resource' from the browser's performance timeline and sets the size of the performance resource data buffer to zero.

    MDN Reference

    Returns void

  • The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.

    MDN Reference

    Parameters

    • event: Event

    Returns boolean

  • The getEntriesByName() method returns an array of PerformanceEntry objects currently present in the performance timeline with the given name and type.

    MDN Reference

    Parameters

    • name: string
    • Optionaltype: string

    Returns PerformanceEntryList

  • The getEntriesByType() method returns an array of PerformanceEntry objects currently present in the performance timeline for a given type.

    MDN Reference

    Parameters

    • type: string

    Returns PerformanceEntryList

  • The mark() method creates a named PerformanceMark object representing a high resolution timestamp marker in the browser's performance timeline.

    MDN Reference

    Parameters

    Returns PerformanceMark

  • The measure() method creates a named PerformanceMeasure object representing a time measurement between two marks in the browser's performance timeline.

    MDN Reference

    Parameters

    Returns PerformanceMeasure

  • The performance.now() method returns a high resolution timestamp in milliseconds.

    MDN Reference

    Returns number

  • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

    MDN Reference

    Type Parameters

    • K extends "resourcetimingbufferfull"

    Parameters

    Returns void

  • The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.

    MDN Reference

    Parameters

    Returns void

  • The setResourceTimingBufferSize() method sets the desired size of the browser's resource timing buffer which stores the 'resource' performance entries.

    MDN Reference

    Parameters

    • maxSize: number

    Returns void

  • The toJSON() method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.

    MDN Reference

    Returns any