Add API and scaffolding for Performance.mark implementation

Summary:
[Changelog][Internal]

Adds API definition for [Performance.mark](https://www.w3.org/TR/user-timing/#mark-method) support.

This is a bare bone implementation, that just logs events on the native side. The next step is the native logic for queuing, flushing etc.

Note that here I route both JS and native marks to native for now, for simplicity sake - ultimately this may not be what we want,  as it may be more efficient to process marks, logged from JS, on the JS side.

Reviewed By: rubennorte

Differential Revision: D41472148

fbshipit-source-id: bdf2b182b8472a71a5500235849bca5af1c2f360
This commit is contained in:
Ruslan Shestopalyuk
2022-11-30 09:28:53 -08:00
committed by Facebook GitHub Bot
parent 2db26c548b
commit a64319a2b2
5 changed files with 90 additions and 10 deletions
@@ -14,6 +14,7 @@ import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
export const RawPerformanceEntryTypeValues = {
UNDEFINED: 0,
MARK: 1,
};
export type RawPerformanceEntryType = number;
@@ -34,6 +35,9 @@ export interface Spec extends TurboModule {
+stopReporting: (entryType: string) => void;
+getPendingEntries: () => $ReadOnlyArray<RawPerformanceEntry>;
+setOnPerformanceEntryCallback: (callback?: () => void) => void;
// NOTE: this is for dev-only purposes (potentially is going to be moved elsewhere)
+logEntryForDebug?: (entry: RawPerformanceEntry) => void;
}
export default (TurboModuleRegistry.get<Spec>(