UNPKG

836 BJavaScriptView Raw
1/**
2 * Copyright (c) 2013-present, Facebook, Inc.
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 */
8
9'use strict';
10
11var EventPluginHub = require('./EventPluginHub');
12
13function runEventQueueInBatch(events) {
14 EventPluginHub.enqueueEvents(events);
15 EventPluginHub.processEventQueue(false);
16}
17
18var ReactEventEmitterMixin = {
19 /**
20 * Streams a fired top-level event to `EventPluginHub` where plugins have the
21 * opportunity to create `ReactEvent`s to be dispatched.
22 */
23 handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
24 var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
25 runEventQueueInBatch(events);
26 }
27};
28
29module.exports = ReactEventEmitterMixin;
\No newline at end of file