Files
react-native/Libraries/NativeModules/specs/NativePerformanceObserverCxx.js
T
Ruslan Shestopalyuk cf55e4a14e JS side implementation of PerformanceObserver API
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
2022-11-04 08:41:01 -07:00

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);