Migrate InteractionTracker

Summary: N.B. There was one duplicate definition which TS rightfully complained about.

Reviewed By: danielbuechele

Differential Revision: D16764036

fbshipit-source-id: 498e4703c2363b19a3bdfa44527bde5000034095
This commit is contained in:
Pascal Hartig
2019-08-13 08:19:52 -07:00
committed by Facebook Github Bot
parent e7cf4380bc
commit 93467193ad
3 changed files with 4 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ import Tooltip from '../Tooltip.js';
import styled from '../../styled/index.js'; import styled from '../../styled/index.js';
import DataPreview from './DataPreview.js'; import DataPreview from './DataPreview.js';
import createPaste from '../../../fb-stubs/createPaste.tsx'; import createPaste from '../../../fb-stubs/createPaste.tsx';
import {reportInteraction} from '../../../utils/InteractionTracker.js'; import {reportInteraction} from '../../../utils/InteractionTracker.tsx';
import {getSortedKeys} from './utils.js'; import {getSortedKeys} from './utils.js';
import {colors} from '../colors.js'; import {colors} from '../colors.js';
import {clipboard} from 'electron'; import {clipboard} from 'electron';

View File

@@ -10,7 +10,7 @@ import type {
Element, Element,
ElementSearchResultSet, ElementSearchResultSet,
} from './ElementsInspector.js'; } from './ElementsInspector.js';
import {reportInteraction} from '../../../utils/InteractionTracker'; import {reportInteraction} from '../../../utils/InteractionTracker.tsx';
import ContextMenu from '../ContextMenu.js'; import ContextMenu from '../ContextMenu.js';
import {PureComponent, type Element as ReactElement} from 'react'; import {PureComponent, type Element as ReactElement} from 'react';
import FlexRow from '../FlexRow.js'; import FlexRow from '../FlexRow.js';

View File

@@ -5,7 +5,7 @@
* @format * @format
*/ */
import {getInstance as getLogger} from '../fb-stubs/Logger.tsx'; import {getInstance as getLogger} from '../fb-stubs/Logger';
export function reportInteraction( export function reportInteraction(
componentType: string, componentType: string,
@@ -20,14 +20,13 @@ class InteractionTracker {
type: string; type: string;
id: string; id: string;
interaction: (name: string, data: any) => void;
constructor(componentType: string, componentIdentifier: string) { constructor(componentType: string, componentIdentifier: string) {
this.type = componentType; this.type = componentType;
this.id = componentIdentifier; this.id = componentIdentifier;
} }
interaction = (name: string, data: any) => { interaction = (name: string, data: any): void => {
getLogger().track('usage', 'interaction', { getLogger().track('usage', 'interaction', {
interaction: InteractionTracker.numberOfInteractions++, interaction: InteractionTracker.numberOfInteractions++,
type: this.type, type: this.type,