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
Properties
ReadonlyeventCounts
The read-only performance.eventCounts property is an EventCounts map containing the number of events which have been dispatched per event type.
Readonlynavigation
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.
onresourcetimingbufferfull
ReadonlytimeOrigin
The timeOrigin read-only property of the Performance interface returns the high resolution timestamp that is used as the baseline for performance-related timestamps.
Readonlytiming
The legacy Performance.timing read-only property returns a PerformanceTiming object containing latency-related performance information.
Methods
addEventListener
- addEventListener<K extends "resourcetimingbufferfull">(
type: K,
listener: (this: Performance, ev: PerformanceEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends "resourcetimingbufferfull"
Parameters
- type: K
- listener: (this: Performance, ev: PerformanceEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
clearMarks
The
clearMarks()method removes all or specific PerformanceMark objects from the browser's performance timeline.Parameters
OptionalmarkName: string
Returns void
clearMeasures
The
clearMeasures()method removes all or specific PerformanceMeasure objects from the browser's performance timeline.Parameters
OptionalmeasureName: string
Returns void
clearResourceTimings
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.Returns void
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
getEntries
The
getEntries()method returns an array of all PerformanceEntry objects currently present in the performance timeline.Returns PerformanceEntryList
getEntriesByName
The
getEntriesByName()method returns an array of PerformanceEntry objects currently present in the performance timeline with the given name and type.Parameters
- name: string
Optionaltype: string
Returns PerformanceEntryList
getEntriesByType
The
getEntriesByType()method returns an array of PerformanceEntry objects currently present in the performance timeline for a given type.Parameters
- type: string
Returns PerformanceEntryList
mark
The
mark()method creates a named PerformanceMark object representing a high resolution timestamp marker in the browser's performance timeline.Parameters
- markName: string
OptionalmarkOptions: PerformanceMarkOptions
Returns PerformanceMark
measure
- measure(
measureName: string,
startOrMeasureOptions?: string | PerformanceMeasureOptions,
endMark?: string,
): PerformanceMeasureThe
measure()method creates a named PerformanceMeasure object representing a time measurement between two marks in the browser's performance timeline.Parameters
- measureName: string
OptionalstartOrMeasureOptions: string | PerformanceMeasureOptionsOptionalendMark: string
Returns PerformanceMeasure
now
The
performance.now()method returns a high resolution timestamp in milliseconds.Returns number
removeEventListener
- removeEventListener<K extends "resourcetimingbufferfull">(
type: K,
listener: (this: Performance, ev: PerformanceEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends "resourcetimingbufferfull"
Parameters
- type: K
- listener: (this: Performance, ev: PerformanceEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
setResourceTimingBufferSize
The
setResourceTimingBufferSize()method sets the desired size of the browser's resource timing buffer which stores the'resource'performance entries.Parameters
- maxSize: number
Returns void
toJSON
The
toJSON()method of the Performance interface is a Serialization; it returns a JSON representation of the Performance object.Returns any
The
Performanceinterface provides access to performance-related information for the current page.MDN Reference