UNPKG

@zendesk/react-measure-timing-hooks

Version:

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

32 lines (31 loc) 2.17 kB
import type { SpanMatcherFn } from './matchSpan'; import type { SpanAndAnnotation } from './spanAnnotationTypes'; import type { FinalTransition, OnEnterStatePayload } from './Trace'; import type { TraceRecording } from './traceRecordingTypes'; import type { DraftTraceContext, RelationSchemasBase, TraceContext } from './types'; export declare function isSuppressedError<RelationSchemasT>(trace: DraftTraceContext<keyof RelationSchemasT, RelationSchemasT, string>, spanAndAnnotation: SpanAndAnnotation<RelationSchemasT>): boolean; export declare function formatMs(ms?: number): string; export declare function getConfigSummary<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT extends RelationSchemasBase<RelationSchemasT>, VariantsT extends string>(traceContext: Pick<DraftTraceContext<SelectedRelationNameT, RelationSchemasT, VariantsT>, 'definition' | 'input'>): { timeout: number; debounce: number | undefined; interactive: number | undefined; }; export declare function getComputedResults<RelationSchemasT>(traceContext: TraceContext<any, RelationSchemasT, any>, finalTransition: FinalTransition<RelationSchemasT>): Partial<TraceRecording<any, RelationSchemasT>>; /** * Extract timing offsets from a transition object */ export declare const extractTimingOffsets: <RelationSchemasT>(transition: OnEnterStatePayload<RelationSchemasT>) => { lastRequiredSpanOffset: number | undefined; completeSpanOffset: number | undefined; cpuIdleSpanOffset: number | undefined; }; /** * Formats a SpanMatcherFn into a more readable string representation. * This is a basic implementation and can be significantly improved * based on the actual structure of `matcher.fromDefinition`. * * @param matcher The matcher function to format. * @param index Optional index for generic naming. * @returns A string representation of the matcher. */ export declare function formatMatcher<SelectedRelationNameT extends keyof RelationSchemasT, RelationSchemasT extends RelationSchemasBase<RelationSchemasT>, VariantsT extends string>(matcher: SpanMatcherFn<SelectedRelationNameT, RelationSchemasT, VariantsT>, index?: number): string;