@samitouri / QOS-React-2 / commits / 91635dd483

Switch to "discrete" and "continuous" terminology

Events were previously described as "interactive" or "non-interactive".

Andrew Clark committed May 30, 2019 at 14:38 UTC 91635dd483c0d4b02836565ca14a1aef23a63ad5
3 files changed +15 -15
packages/events/ReactSyntheticEventType.js
+1 -1
@@ -18,7 +18,7 @@ export type DispatchConfig = {
18 captured: string,
19 },
20 registrationName?: string,
21 - isInteractive?: boolean,
21 + isDiscrete?: boolean,
22 };
23
24 export type ReactSyntheticEvent = {
packages/react-dom/src/events/ReactDOMEventListener.js
+5 -5
@@ -45,7 +45,7 @@ import {passiveBrowserEventsSupported} from './checkPassiveEvents';
45
46 import {enableEventAPI} from 'shared/ReactFeatureFlags';
47
48 -const {isInteractiveTopLevelEventType} = SimpleEventPlugin;
48 +const {isDiscreteTopLevelEventType} = SimpleEventPlugin;
49
50 const CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
51 const callbackBookkeepingPool = [];
@@ -215,11 +215,11 @@ function trapEventForPluginEventSystem(
215 topLevelType: DOMTopLevelEventType,
216 capture: boolean,
217 ): void {
218 - const dispatch = isInteractiveTopLevelEventType(topLevelType)
219 - ? dispatchInteractiveEvent
218 + const dispatch = isDiscreteTopLevelEventType(topLevelType)
219 + ? dispatchDiscreteEvent
220 : dispatchEvent;
221 const rawEventName = getRawEventName(topLevelType);
222 - // Check if interactive and wrap in discreteUpdates
222 + // Check if discrete and wrap in discreteUpdates
223 const listener = dispatch.bind(null, topLevelType, PLUGIN_EVENT_SYSTEM);
224 if (capture) {
225 addEventCaptureListener(element, rawEventName, listener);
@@ -228,7 +228,7 @@ function trapEventForPluginEventSystem(
228 }
229 }
230
231 -function dispatchInteractiveEvent(topLevelType, eventSystemFlags, nativeEvent) {
231 +function dispatchDiscreteEvent(topLevelType, eventSystemFlags, nativeEvent) {
232 if (!enableEventAPI || shouldflushDiscreteUpdates(nativeEvent.timeStamp)) {
233 flushDiscreteUpdates();
234 }
packages/react-dom/src/events/SimpleEventPlugin.js
+9 -9
@@ -56,7 +56,7 @@ import getEventCharCode from './getEventCharCode';
56 * ]);
57 */
58 type EventTuple = [DOMTopLevelEventType, string];
59 -const interactiveEventTypeNames: Array<EventTuple> = [
59 +const discreteEventTypeNames: Array<EventTuple> = [
60 [DOMTopLevelEventTypes.TOP_BLUR, 'blur'],
61 [DOMTopLevelEventTypes.TOP_CANCEL, 'cancel'],
62 [DOMTopLevelEventTypes.TOP_CLICK, 'click'],
@@ -92,7 +92,7 @@ const interactiveEventTypeNames: Array<EventTuple> = [
92 [DOMTopLevelEventTypes.TOP_TOUCH_START, 'touchStart'],
93 [DOMTopLevelEventTypes.TOP_VOLUME_CHANGE, 'volumeChange'],
94 ];
95 -const nonInteractiveEventTypeNames: Array<EventTuple> = [
95 +const continuousEventTypeNames: Array<EventTuple> = [
96 [DOMTopLevelEventTypes.TOP_ABORT, 'abort'],
97 [DOMTopLevelEventTypes.TOP_ANIMATION_END, 'animationEnd'],
98 [DOMTopLevelEventTypes.TOP_ANIMATION_ITERATION, 'animationIteration'],
@@ -142,7 +142,7 @@ const topLevelEventsToDispatchConfig: {
142
143 function addEventTypeNameToConfig(
144 [topEvent, event]: EventTuple,
145 - isInteractive: boolean,
145 + isDiscrete: boolean,
146 ) {
147 const capitalizedEvent = event[0].toUpperCase() + event.slice(1);
148 const onEvent = 'on' + capitalizedEvent;
@@ -153,16 +153,16 @@ function addEventTypeNameToConfig(
153 captured: onEvent + 'Capture',
154 },
155 dependencies: [topEvent],
156 - isInteractive,
156 + isDiscrete,
157 };
158 eventTypes[event] = type;
159 topLevelEventsToDispatchConfig[topEvent] = type;
160 }
161
162 -interactiveEventTypeNames.forEach(eventTuple => {
162 +discreteEventTypeNames.forEach(eventTuple => {
163 addEventTypeNameToConfig(eventTuple, true);
164 });
165 -nonInteractiveEventTypeNames.forEach(eventTuple => {
165 +continuousEventTypeNames.forEach(eventTuple => {
166 addEventTypeNameToConfig(eventTuple, false);
167 });
168
@@ -202,13 +202,13 @@ const knownHTMLTopLevelTypes: Array<DOMTopLevelEventType> = [
202 ];
203
204 const SimpleEventPlugin: PluginModule<MouseEvent> & {
205 - isInteractiveTopLevelEventType: (topLevelType: TopLevelType) => boolean,
205 + isDiscreteTopLevelEventType: (topLevelType: TopLevelType) => boolean,
206 } = {
207 eventTypes: eventTypes,
208
209 - isInteractiveTopLevelEventType(topLevelType: TopLevelType): boolean {
209 + isDiscreteTopLevelEventType(topLevelType: TopLevelType): boolean {
210 const config = topLevelEventsToDispatchConfig[topLevelType];
211 - return config !== undefined && config.isInteractive === true;
211 + return config !== undefined && config.isDiscrete === true;
212 },
213
214 extractEvents: function(