UNPKG

958 BJavaScriptView Raw
1/**
2 * Copyright 2013-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
8 *
9 */
10
11'use strict';
12
13var EventPluginHub = require('./EventPluginHub');
14
15function runEventQueueInBatch(events) {
16 EventPluginHub.enqueueEvents(events);
17 EventPluginHub.processEventQueue(false);
18}
19
20var ReactEventEmitterMixin = {
21 /**
22 * Streams a fired top-level event to `EventPluginHub` where plugins have the
23 * opportunity to create `ReactEvent`s to be dispatched.
24 */
25 handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
26 var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
27 runEventQueueInBatch(events);
28 }
29};
30
31module.exports = ReactEventEmitterMixin;
\No newline at end of file