Skip to content

Commit b4608dd

Browse files
nadavkanersophiebits
authored andcommitted
Remove unused simulated flag parameter (facebook#14127)
1 parent 3c69a18 commit b4608dd

5 files changed

Lines changed: 12 additions & 36 deletions

File tree

packages/events/EventPluginHub.js

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,19 @@ let eventQueue: ?(Array<ReactSyntheticEvent> | ReactSyntheticEvent) = null;
3737
* Dispatches an event and releases it back into the pool, unless persistent.
3838
*
3939
* @param {?object} event Synthetic event to be dispatched.
40-
* @param {boolean} simulated If the event is simulated (changes exn behavior)
4140
* @private
4241
*/
43-
const executeDispatchesAndRelease = function(
44-
event: ReactSyntheticEvent,
45-
simulated: boolean,
46-
) {
42+
const executeDispatchesAndRelease = function(event: ReactSyntheticEvent) {
4743
if (event) {
48-
executeDispatchesInOrder(event, simulated);
44+
executeDispatchesInOrder(event);
4945

5046
if (!event.isPersistent()) {
5147
event.constructor.release(event);
5248
}
5349
}
5450
};
55-
const executeDispatchesAndReleaseSimulated = function(e) {
56-
return executeDispatchesAndRelease(e, true);
57-
};
5851
const executeDispatchesAndReleaseTopLevel = function(e) {
59-
return executeDispatchesAndRelease(e, false);
52+
return executeDispatchesAndRelease(e);
6053
};
6154

6255
function isInteractive(tag) {
@@ -192,7 +185,6 @@ function extractEvents(
192185

193186
export function runEventsInBatch(
194187
events: Array<ReactSyntheticEvent> | ReactSyntheticEvent | null,
195-
simulated: boolean,
196188
) {
197189
if (events !== null) {
198190
eventQueue = accumulateInto(eventQueue, events);
@@ -207,17 +199,7 @@ export function runEventsInBatch(
207199
return;
208200
}
209201

210-
if (simulated) {
211-
forEachAccumulated(
212-
processingEventQueue,
213-
executeDispatchesAndReleaseSimulated,
214-
);
215-
} else {
216-
forEachAccumulated(
217-
processingEventQueue,
218-
executeDispatchesAndReleaseTopLevel,
219-
);
220-
}
202+
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
221203
invariant(
222204
!eventQueue,
223205
'processEventQueue(): Additional events were enqueued while processing ' +
@@ -239,5 +221,5 @@ export function runExtractedEventsInBatch(
239221
nativeEvent,
240222
nativeEventTarget,
241223
);
242-
runEventsInBatch(events, false);
224+
runEventsInBatch(events);
243225
}

packages/events/EventPluginUtils.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ if (__DEV__) {
6060
/**
6161
* Dispatch the event to the listener.
6262
* @param {SyntheticEvent} event SyntheticEvent to handle
63-
* @param {boolean} simulated If the event is simulated (changes exn behavior)
6463
* @param {function} listener Application-level callback
6564
* @param {*} inst Internal component instance
6665
*/
67-
function executeDispatch(event, simulated, listener, inst) {
66+
function executeDispatch(event, listener, inst) {
6867
const type = event.type || 'unknown-event';
6968
event.currentTarget = getNodeFromInstance(inst);
7069
invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
@@ -74,7 +73,7 @@ function executeDispatch(event, simulated, listener, inst) {
7473
/**
7574
* Standard/simple iteration through an event's collected dispatches.
7675
*/
77-
export function executeDispatchesInOrder(event, simulated) {
76+
export function executeDispatchesInOrder(event) {
7877
const dispatchListeners = event._dispatchListeners;
7978
const dispatchInstances = event._dispatchInstances;
8079
if (__DEV__) {
@@ -86,15 +85,10 @@ export function executeDispatchesInOrder(event, simulated) {
8685
break;
8786
}
8887
// Listeners and Instances are two parallel arrays that are always in sync.
89-
executeDispatch(
90-
event,
91-
simulated,
92-
dispatchListeners[i],
93-
dispatchInstances[i],
94-
);
88+
executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
9589
}
9690
} else if (dispatchListeners) {
97-
executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
91+
executeDispatch(event, dispatchListeners, dispatchInstances);
9892
}
9993
event._dispatchListeners = null;
10094
event._dispatchInstances = null;

packages/events/__tests__/ResponderEventPlugin-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ const run = function(config, hierarchyConfig, nativeEventConfig) {
321321
// At this point the negotiation events have been dispatched as part of the
322322
// extraction process, but not the side effectful events. Below, we dispatch
323323
// side effectful events.
324-
EventPluginHub.runEventsInBatch(extractedEvents, true);
324+
EventPluginHub.runEventsInBatch(extractedEvents);
325325

326326
// Ensure that every event that declared an `order`, was actually dispatched.
327327
expect('number of events dispatched:' + runData.dispatchCount).toBe(

packages/react-dom/src/events/ChangeEventPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function manualDispatchChangeEvent(nativeEvent) {
100100
}
101101

102102
function runEventInBatch(event) {
103-
EventPluginHub.runEventsInBatch(event, false);
103+
EventPluginHub.runEventsInBatch(event);
104104
}
105105

106106
function getInstIfValueChanged(targetInst) {

packages/react-dom/src/test-utils/ReactTestUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ function makeSimulator(eventType) {
435435
// Normally extractEvent enqueues a state restore, but we'll just always
436436
// do that since we we're by-passing it here.
437437
enqueueStateRestore(domNode);
438-
runEventsInBatch(event, true);
438+
runEventsInBatch(event);
439439
});
440440
restoreStateIfNeeded();
441441
};

0 commit comments

Comments
 (0)