Skip to content

Commit e3eeadb

Browse files
Dmytro Voronkevychfacebook-github-bot
authored andcommitted
Adding new markerAnnotateWithMap method
Summary: ## Changelog: [Internal] [Added] - Adding new markerAnnotateWithMap to the QPL. This is part of bigger effort to unify JS QPL interfaces across platforms. Reviewed By: eddyerburgh Differential Revision: D40796537 fbshipit-source-id: a75b97c20ca411653552228f7dc2fcbedd8ddca9
1 parent 58a1cd2 commit e3eeadb

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

Libraries/Performance/QuickPerformanceLogger.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
const AUTO_SET_TIMESTAMP = -1;
1414
const DUMMY_INSTANCE_KEY = 0;
1515

16-
// Defines map of annotations for markEvent
16+
// Defines map of annotations
1717
// Use as following:
1818
// {string: {key1: value1, key2: value2}}
1919
export type AnnotationsMap = $Shape<{
@@ -68,6 +68,30 @@ const QuickPerformanceLogger = {
6868
}
6969
},
7070

71+
markerAnnotateWithMap(
72+
markerId: number,
73+
annotations: AnnotationsMap,
74+
instanceKey: number = DUMMY_INSTANCE_KEY,
75+
): void {
76+
if (global.nativeQPLMarkerAnnotateWithMap) {
77+
global.nativeQPLMarkerAnnotateWithMap(markerId, annotations, instanceKey);
78+
} else if (global.nativeQPLMarkerAnnotate) {
79+
for (var type of ['string']) {
80+
var keyValsOfType = annotations[type];
81+
if (keyValsOfType !== null && keyValsOfType !== undefined) {
82+
for (var annotationKey of Object.keys(keyValsOfType)) {
83+
global.nativeQPLMarkerAnnotate(
84+
markerId,
85+
instanceKey,
86+
annotationKey,
87+
keyValsOfType[annotationKey].toString(),
88+
);
89+
}
90+
}
91+
}
92+
}
93+
},
94+
7195
markerCancel(
7296
markerId: number,
7397
instanceKey?: number = DUMMY_INSTANCE_KEY,

0 commit comments

Comments
 (0)