Skip to content

Commit

Permalink
add launch ID support
Browse files Browse the repository at this point in the history
  • Loading branch information
EdmondChuiHW committed Mar 20, 2024
1 parent c80fa1f commit c4a0fa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions front_end/core/host/RNPerfMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function getInstance(): RNPerfMetrics {
type UnsunscribeFn = () => void;
class RNPerfMetrics {
#listeners: Set<RNReliabilityEventListener> = new Set();
#launchId: string|null = null;

addEventListener(listener: RNReliabilityEventListener): UnsunscribeFn {
this.#listeners.add(listener);
Expand Down Expand Up @@ -51,6 +52,11 @@ class RNPerfMetrics {
console.error('Error occurred when calling event listeners', error);
}
}

setLaunchId(launchId: string|null): void {
this.#launchId = launchId;
}

}

export function registerPerfMetricsGlobalPostMessageHandler(): void {
Expand Down
1 change: 1 addition & 0 deletions front_end/entrypoints/rn_inspector/rn_inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type * as InspectorBackend from '../../core/protocol_client/InspectorBack

Host.RNPerfMetrics.registerPerfMetricsGlobalPostMessageHandler();

Host.rnPerfMetrics.setLaunchId(Root.Runtime.Runtime.queryParam('launchId'));
// Legacy JavaScript Profiler - we support this until Hermes can support the
// modern Performance panel.
Root.Runtime.experiments.register(
Expand Down

0 comments on commit c4a0fa0

Please sign in to comment.