UNPKG

@zendesk/react-measure-timing-hooks

Version:

react hooks for measuring time to interactive and time to render of components

25 lines (24 loc) 1.5 kB
import type { NativePerformanceEntryType } from './spanTypes'; import type { TraceManager } from './TraceManager'; import type { DeriveRelationsFromPerformanceEntryFn, RelationSchemasBase } from './types'; export declare const getBestSupportedEntryTypes: () => NativePerformanceEntryType[]; /** * The function creates an instance of PerformanceObserver that integrates with a TraceManager to automatically observe * and map specified types of performance entries from the browser's Performance API to trace entries. * @param traceManager - An instance of TraceManager * that will handle the processing * of mapped performance entries. * @param entryTypes - An array of strings specifying the types of * performance entries to observe (e.g., * ["resource", "navigation"]). * * @returns A cleanup function that, when called, disconnects the * PerformanceObserver, stopping the observation of * performance entries. */ export declare const observePerformanceWithTraceManager: <RelationSchemasT extends RelationSchemasBase<RelationSchemasT>>({ traceManager, deriveRelationFromPerformanceEntry, entryTypes, keep, }: { traceManager: TraceManager<RelationSchemasT>; deriveRelationFromPerformanceEntry?: DeriveRelationsFromPerformanceEntryFn<RelationSchemasT>; entryTypes?: NativePerformanceEntryType[]; keep?: (entry: PerformanceEntry) => boolean; }) => () => undefined;