mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Scaffolding for the PerformanceObserver TurboModule (C++ side) (#35226)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35226 Changelog: [Internal] This adds scaffolding for the C++ side of NativePerformanceObserver module. Thanks to christophpurrer for helping set this up, as this is the first one of this kind inside core/OSS. Reviewed By: rubennorte Differential Revision: D41028555 fbshipit-source-id: 4acf0e71a254a42044cbbe5f94f40938342c6aa2
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ea1d72921d
commit
ea73a66936
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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 const RawPerformanceEntryTypeValues = {
|
||||
UNDEFINED: 0,
|
||||
};
|
||||
|
||||
export type RawPerformanceEntryType = number;
|
||||
|
||||
export type RawPerformanceEntry = $ReadOnly<{
|
||||
name: string,
|
||||
entryType: RawPerformanceEntryType,
|
||||
startTime: number,
|
||||
duration: number,
|
||||
// For "event" entries only:
|
||||
processingStart?: number,
|
||||
processingEnd?: number,
|
||||
interactionId?: number,
|
||||
}>;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+startReporting: (entryType: string) => void;
|
||||
+stopReporting: (entryType: string) => void;
|
||||
+getPendingEntries: () => $ReadOnlyArray<RawPerformanceEntry>;
|
||||
+setOnPerformanceEntryCallback: (callback?: () => void) => void;
|
||||
}
|
||||
|
||||
export default (TurboModuleRegistry.get<Spec>(
|
||||
'NativePerformanceObserverCxx',
|
||||
): ?Spec);
|
||||
Reference in New Issue
Block a user