Skip to content

Commit 1f15a64

Browse files
JoshuaGrossfacebook-github-bot
authored andcommitted
Add RawEventTelemetryEventEmitter interface to ReactNativePrivateInterface
Summary: This will be used from the React JS renderer in a followup PR. Changelog: [Added][JS] New event telemetry mechanism exposed from JS to supercede the Pressability-specific telemetry mechanism Reviewed By: ryancat Differential Revision: D33986916 fbshipit-source-id: 912d0b351869348f0ca6e5f6a882fc0501c2c7f0
1 parent 97ce240 commit 1f15a64

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/**
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict-local
8+
* @format
9+
*/
10+
11+
import EventEmitter from '../vendor/emitter/EventEmitter';
12+
import type {IEventEmitter} from '../vendor/emitter/EventEmitter';
13+
14+
export type RawEventTelemetryEvent = $ReadOnly<{|
15+
eventName: string,
16+
// We expect, but do not/cannot require, that nativeEvent is an object
17+
// with the properties: key, elementType (string), type (string), tag (numeric),
18+
// and a stateNode of the native element/Fiber the event was emitted to.
19+
nativeEvent: {[string]: mixed},
20+
|}>;
21+
22+
type RawEventDefinitions = {
23+
[eventChannel: string]: [RawEventTelemetryEvent],
24+
};
25+
26+
const RawEventTelemetryEventEmitter: IEventEmitter<RawEventDefinitions> =
27+
new EventEmitter<RawEventDefinitions>();
28+
29+
export default RawEventTelemetryEventEmitter;

Libraries/ReactPrivate/ReactNativePrivateInterface.js

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import typeof flattenStyle from '../StyleSheet/flattenStyle';
2121
import {type DangerouslyImpreciseStyleProp} from '../StyleSheet/StyleSheet';
2222
import typeof ReactFiberErrorDialog from '../Core/ReactFiberErrorDialog';
2323
import typeof legacySendAccessibilityEvent from '../Components/AccessibilityInfo/legacySendAccessibilityEvent';
24+
import typeof RawEventTelemetryEventEmitter from '../Core/RawEventTelemetryEventEmitter';
2425

2526
// flowlint unsafe-getters-setters:off
2627
module.exports = {
@@ -62,4 +63,7 @@ module.exports = {
6263
get legacySendAccessibilityEvent(): legacySendAccessibilityEvent {
6364
return require('../Components/AccessibilityInfo/legacySendAccessibilityEvent');
6465
},
66+
get RawEventTelemetryEventEmitter(): RawEventTelemetryEventEmitter {
67+
return require('../Core/RawEventTelemetryEventEmitter').default;
68+
},
6569
};

0 commit comments

Comments
 (0)