mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39951 ## Changelog: [Internal] - This makes PerformanceObserver API more robust in regards of telling which exactly types of the performance entries are supported. At this point, we either tell that we support mark/measure/event ones on the New Architecture, or none otherwise. The source of truth of this information should be on the native side. Reviewed By: rubennorte Differential Revision: D50010982 fbshipit-source-id: ad7bce279a58eac232b7c26f8d8c2bd1cde51e3c
62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict
|
|
* @format
|
|
*/
|
|
|
|
import type {TurboModule} from '../TurboModule/RCTExport';
|
|
|
|
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
|
|
|
export type RawPerformanceEntryType = number;
|
|
|
|
export type RawPerformanceEntry = {|
|
|
name: string,
|
|
entryType: RawPerformanceEntryType,
|
|
startTime: number,
|
|
duration: number,
|
|
// For "event" entries only:
|
|
processingStart?: number,
|
|
processingEnd?: number,
|
|
interactionId?: number,
|
|
|};
|
|
|
|
export type GetPendingEntriesResult = {|
|
|
entries: $ReadOnlyArray<RawPerformanceEntry>,
|
|
droppedEntriesCount: number,
|
|
|};
|
|
|
|
export interface Spec extends TurboModule {
|
|
+startReporting: (entryType: RawPerformanceEntryType) => void;
|
|
+stopReporting: (entryType: RawPerformanceEntryType) => void;
|
|
+setIsBuffered: (
|
|
entryTypes: $ReadOnlyArray<RawPerformanceEntryType>,
|
|
isBuffered: boolean,
|
|
) => void;
|
|
+popPendingEntries: () => GetPendingEntriesResult;
|
|
+setOnPerformanceEntryCallback: (callback?: () => void) => void;
|
|
+logRawEntry: (entry: RawPerformanceEntry) => void;
|
|
+getEventCounts: () => $ReadOnlyArray<[string, number]>;
|
|
+setDurationThreshold: (
|
|
entryType: RawPerformanceEntryType,
|
|
durationThreshold: number,
|
|
) => void;
|
|
+clearEntries: (
|
|
entryType: RawPerformanceEntryType,
|
|
entryName?: string,
|
|
) => void;
|
|
+getEntries: (
|
|
entryType?: RawPerformanceEntryType,
|
|
entryName?: string,
|
|
) => $ReadOnlyArray<RawPerformanceEntry>;
|
|
+getSupportedPerformanceEntryTypes: () => $ReadOnlyArray<RawPerformanceEntryType>;
|
|
}
|
|
|
|
export default (TurboModuleRegistry.get<Spec>(
|
|
'NativePerformanceObserverCxx',
|
|
): ?Spec);
|