Skip to content

Commit

Permalink
Add various annotation types to markEvent ReactNative API
Browse files Browse the repository at this point in the history
Summary:
Support various annotations types in QuickPerformanceLogger markEvent for Android.

Changelog:
[Internal][Changed] - Added support for various markEvent annotation types

Reviewed By: dmitry-voronkevich

Differential Revision: D40852658

fbshipit-source-id: fc4053555f65958653be30a58742c83040a19df1
  • Loading branch information
Sergei Karpukhin authored and facebook-github-bot committed Nov 3, 2022
1 parent aaf1990 commit 890805d
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Libraries/Performance/QuickPerformanceLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ const DUMMY_INSTANCE_KEY = 0;
// {string: {key1: value1, key2: value2}}
export type AnnotationsMap = $Shape<{
string: ?{[string]: string, ...},
int: ?{[string]: number, ...},
double: ?{[string]: number, ...},
bool: ?{[string]: boolean, ...},
string_array: ?{[string]: $ReadOnlyArray<string>, ...},
int_array: ?{[string]: $ReadOnlyArray<number>, ...},
double_array: ?{[string]: $ReadOnlyArray<number>, ...},
bool_array: ?{[string]: $ReadOnlyArray<boolean>, ...},
}>;

const QuickPerformanceLogger = {
Expand Down Expand Up @@ -60,7 +67,16 @@ const QuickPerformanceLogger = {
if (global.nativeQPLMarkerAnnotateWithMap) {
global.nativeQPLMarkerAnnotateWithMap(markerId, annotations, instanceKey);
} else if (global.nativeQPLMarkerAnnotate) {
for (const type of ['string']) {
for (const type of [
'string',
'int',
'double',
'bool',
'string_array',
'int_array',
'double_array',
'bool_array',
]) {
const keyValsOfType = annotations[type];
if (keyValsOfType != null) {
for (const annotationKey of Object.keys(keyValsOfType)) {
Expand Down

0 comments on commit 890805d

Please sign in to comment.