Skip to content

Commit

Permalink
Adding string annotations to markEvent
Browse files Browse the repository at this point in the history
Summary:
Adding string annotations support to markEvent API in ReactNative

Changelog:
[Internal][Change] - markEvent API now supports string annotations

Differential Revision: D33795346

fbshipit-source-id: 414cbd08ce5ff6045e2f35ae77059be5add3d834
  • Loading branch information
dmitry-voronkevich authored and facebook-github-bot committed Jan 27, 2022
1 parent 0e39b95 commit 12a6742
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Libraries/Performance/QuickPerformanceLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
const AUTO_SET_TIMESTAMP = -1;
const DUMMY_INSTANCE_KEY = 0;

// Defines map of annotations for markEvent
// Use as following:
// {string: {key1: value1, key2: value2}}
export type AnnotationsMap = $Shape<{
string: ?{[string]: string, ...},
}>;

const QuickPerformanceLogger = {
markerStart(
markerId: number,
Expand Down Expand Up @@ -90,9 +97,13 @@ const QuickPerformanceLogger = {
}
},

markEvent(markerId: number, type: string): void {
markEvent(
markerId: number,
type: string,
annotations: ?AnnotationsMap = null,
): void {
if (global.nativeQPLMarkEvent) {
global.nativeQPLMarkEvent(markerId, type);
global.nativeQPLMarkEvent(markerId, type, annotations);
}
},

Expand Down

0 comments on commit 12a6742

Please sign in to comment.