Track play-pause usage
Summary: ^ Reviewed By: aigoncharov Differential Revision: D44169950 fbshipit-source-id: 7a10c6849382680723687a63fd987b9766076af9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
723bc52c38
commit
9b9674be2d
41
desktop/plugins/public/ui-debugger/tracker.tsx
Normal file
41
desktop/plugins/public/ui-debugger/tracker.tsx
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {getFlipperLib} from 'flipper-plugin';
|
||||
|
||||
const UI_DEBUGGER_IDENTIFIER = 'ui-debugger';
|
||||
|
||||
type TrackerEvents = {
|
||||
'play-pause': {
|
||||
paused: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export interface Tracker {
|
||||
track<Event extends keyof TrackerEvents>(
|
||||
event: Event,
|
||||
payload: TrackerEvents[Event],
|
||||
): void;
|
||||
}
|
||||
|
||||
class UIDebuggerTracker implements Tracker {
|
||||
track<Event extends 'play-pause'>(
|
||||
event: Event,
|
||||
payload: TrackerEvents[Event],
|
||||
): void {
|
||||
getFlipperLib().logger.track(
|
||||
'usage',
|
||||
event,
|
||||
payload,
|
||||
UI_DEBUGGER_IDENTIFIER,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const tracker: Tracker = new UIDebuggerTracker();
|
||||
Reference in New Issue
Block a user