You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
/** |
|
* Copyright 2013-2015, Facebook, Inc. |
|
* All rights reserved. |
|
* |
|
* This source code is licensed under the BSD-style license found in the |
|
* LICENSE file in the root directory of this source tree. An additional grant |
|
* of patent rights can be found in the PATENTS file in the same directory. |
|
* |
|
* @providesModule ReactEventEmitterMixin |
|
*/ |
|
|
|
'use strict'; |
|
|
|
var EventPluginHub = require("./EventPluginHub"); |
|
|
|
function runEventQueueInBatch(events) { |
|
EventPluginHub.enqueueEvents(events); |
|
EventPluginHub.processEventQueue(); |
|
} |
|
|
|
var ReactEventEmitterMixin = { |
|
|
|
/** |
|
* Streams a fired top-level event to `EventPluginHub` where plugins have the |
|
* opportunity to create `ReactEvent`s to be dispatched. |
|
* |
|
* @param {string} topLevelType Record from `EventConstants`. |
|
* @param {object} topLevelTarget The listening component root node. |
|
* @param {string} topLevelTargetID ID of `topLevelTarget`. |
|
* @param {object} nativeEvent Native environment event. |
|
*/ |
|
handleTopLevel: function( |
|
topLevelType, |
|
topLevelTarget, |
|
topLevelTargetID, |
|
nativeEvent) { |
|
var events = EventPluginHub.extractEvents( |
|
topLevelType, |
|
topLevelTarget, |
|
topLevelTargetID, |
|
nativeEvent |
|
); |
|
|
|
runEventQueueInBatch(events); |
|
} |
|
}; |
|
|
|
module.exports = ReactEventEmitterMixin;
|
|
|