diff --git a/Libraries/WebPerformance/NativePerformance.js b/Libraries/WebPerformance/NativePerformance.js index 369dd23f7cf..85435b47997 100644 --- a/Libraries/WebPerformance/NativePerformance.js +++ b/Libraries/WebPerformance/NativePerformance.js @@ -13,10 +13,10 @@ import type {TurboModule} from '../TurboModule/RCTExport'; import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { - +mark?: (name: string, startTime: number, duration: number) => void; - +clearMarks?: (markName?: string) => void; + +mark: (name: string, startTime: number, duration: number) => void; + +clearMarks: (markName?: string) => void; - +measure?: ( + +measure: ( name: string, startTime: number, endTime: number, @@ -24,7 +24,7 @@ export interface Spec extends TurboModule { startMark?: string, endMark?: string, ) => void; - +clearMeasures?: (measureName?: string) => void; + +clearMeasures: (measureName?: string) => void; } export default (TurboModuleRegistry.get('NativePerformanceCxx'): ?Spec); diff --git a/Libraries/WebPerformance/NativePerformanceObserver.cpp b/Libraries/WebPerformance/NativePerformanceObserver.cpp index bd10d51ac80..84864a69de2 100644 --- a/Libraries/WebPerformance/NativePerformanceObserver.cpp +++ b/Libraries/WebPerformance/NativePerformanceObserver.cpp @@ -45,11 +45,6 @@ std::vector NativePerformanceObserver::popPendingEntries( return PerformanceEntryReporter::getInstance().popPendingEntries(); } -std::vector NativePerformanceObserver::getPendingEntries( - jsi::Runtime &rt) { - return PerformanceEntryReporter::getInstance().getPendingEntries(); -} - void NativePerformanceObserver::setOnPerformanceEntryCallback( jsi::Runtime &rt, std::optional> callback) { diff --git a/Libraries/WebPerformance/NativePerformanceObserver.h b/Libraries/WebPerformance/NativePerformanceObserver.h index a0e57aaf80a..9b8b6cd591c 100644 --- a/Libraries/WebPerformance/NativePerformanceObserver.h +++ b/Libraries/WebPerformance/NativePerformanceObserver.h @@ -52,7 +52,6 @@ class NativePerformanceObserver void stopReporting(jsi::Runtime &rt, std::string entryType); std::vector popPendingEntries(jsi::Runtime &rt); - std::vector getPendingEntries(jsi::Runtime &rt); void setOnPerformanceEntryCallback( jsi::Runtime &rt, diff --git a/Libraries/WebPerformance/NativePerformanceObserver.js b/Libraries/WebPerformance/NativePerformanceObserver.js index 88f1e16b2ae..91bd8fc0ab5 100644 --- a/Libraries/WebPerformance/NativePerformanceObserver.js +++ b/Libraries/WebPerformance/NativePerformanceObserver.js @@ -34,10 +34,7 @@ export type RawPerformanceEntry = {| export interface Spec extends TurboModule { +startReporting: (entryType: string) => void; +stopReporting: (entryType: string) => void; - // TODO: This is unused and only kept for the compatibility check. - // Clean it up once the API is complete. - +getPendingEntries: () => $ReadOnlyArray; - +popPendingEntries?: () => $ReadOnlyArray; + +popPendingEntries: () => $ReadOnlyArray; +setOnPerformanceEntryCallback: (callback?: () => void) => void; } diff --git a/Libraries/WebPerformance/PerformanceObserver.js b/Libraries/WebPerformance/PerformanceObserver.js index 53046dd8603..a4238be2b51 100644 --- a/Libraries/WebPerformance/PerformanceObserver.js +++ b/Libraries/WebPerformance/PerformanceObserver.js @@ -137,7 +137,7 @@ const onPerformanceEntry = () => { if (!NativePerformanceObserver) { return; } - const rawEntries = NativePerformanceObserver.popPendingEntries?.() ?? []; + const rawEntries = NativePerformanceObserver.popPendingEntries() ?? []; if (rawEntries.length === 0) { return; }