Skip to content

Commit

Permalink
React Native: Touch Instrumentation Interface (#21024)
Browse files Browse the repository at this point in the history
  • Loading branch information
yungsters authored Mar 17, 2021
1 parent 119736b commit 3fb11ee
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,21 @@ function printTouchBank(): string {
return printed;
}

let instrumentationCallback: ?(string, TouchEvent) => void;

const ResponderTouchHistoryStore = {
/**
* Registers a listener which can be used to instrument every touch event.
*/
instrument(callback: (string, TouchEvent) => void): void {
instrumentationCallback = callback;
},

recordTouchTrack(topLevelType: string, nativeEvent: TouchEvent): void {
if (instrumentationCallback != null) {
instrumentationCallback(topLevelType, nativeEvent);
}

if (isMoveish(topLevelType)) {
nativeEvent.changedTouches.forEach(recordTouchMove);
} else if (isStartish(topLevelType)) {
Expand Down

0 comments on commit 3fb11ee

Please sign in to comment.