From 72fb914269e341fcd4782384f56532d68f6ffd24 Mon Sep 17 00:00:00 2001 From: Edmond Chui <1967998+EdmondChuiHW@users.noreply.github.com> Date: Fri, 22 Mar 2024 19:42:15 +0000 Subject: [PATCH] rm interface from RNPerfMetrics (#26) --- front_end/core/host/RNPerfMetrics.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/front_end/core/host/RNPerfMetrics.ts b/front_end/core/host/RNPerfMetrics.ts index 104997934ab..cc78ad02400 100644 --- a/front_end/core/host/RNPerfMetrics.ts +++ b/front_end/core/host/RNPerfMetrics.ts @@ -5,26 +5,20 @@ export type RNReliabilityEventListener = (event: ReactNativeChromeDevToolsEvent) => void; -type UnsunscribeFn = () => void; -export type RNPerfMetrics = { - addEventListener: (listener: RNReliabilityEventListener) => UnsunscribeFn, - removeAllEventListeners: () => void, - sendEvent: (event: ReactNativeChromeDevToolsEvent) => void, -}; - let instance: RNPerfMetrics|null = null; export function getInstance(): RNPerfMetrics { if (instance === null) { - instance = new RNPerfMetricsImpl(); + instance = new RNPerfMetrics(); } return instance; } -class RNPerfMetricsImpl implements RNPerfMetrics { +type UnsubscribeFn = () => void; +class RNPerfMetrics { #listeners: Set = new Set(); - addEventListener(listener: RNReliabilityEventListener): () => void { + addEventListener(listener: RNReliabilityEventListener): UnsubscribeFn { this.#listeners.add(listener); const unsubscribe = (): void => {