mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
cf55e4a14e
Summary: [Changelog][Internal] This adds module specs for the native part of PerformanceObserver, as well as the interaction logic vs the NativePerformanceObserver API. See https://fb.quip.com/MdqgAk1Eb2dV for more detail. Reviewed By: rubennorte Differential Revision: D40897006 fbshipit-source-id: 77475f21dad9ee9dbe15df5a989eb08d314e6db2
45 lines
1.2 KiB
JavaScript
45 lines
1.2 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 RawTimeStamp = number;
|
|
|
|
export const RawPerformanceEntryTypeValues = {
|
|
UNDEFINED: 0,
|
|
};
|
|
|
|
export type RawPerformanceEntryType = number;
|
|
|
|
export type RawPerformanceEntry = $ReadOnly<{
|
|
name: string,
|
|
entryType: RawPerformanceEntryType,
|
|
startTime: RawTimeStamp,
|
|
duration: number,
|
|
|
|
// For "event" entries only:
|
|
processingStart?: RawTimeStamp,
|
|
processingEnd?: RawTimeStamp,
|
|
interactionId?: RawTimeStamp,
|
|
}>;
|
|
|
|
export type RawPerformanceEntryList = $ReadOnlyArray<RawPerformanceEntry>;
|
|
|
|
export interface Spec extends TurboModule {
|
|
+startReporting: (entryType: string) => void;
|
|
+stopReporting: (entryType: string) => void;
|
|
+getPendingEntries: () => RawPerformanceEntryList;
|
|
+setOnPerformanceEntryCallback: (callback?: () => void) => void;
|
|
}
|
|
|
|
export default (TurboModuleRegistry.get<Spec>('PerformanceObserver'): ?Spec);
|