* Publishes an event so that it can be dispatched by the supplied plugin. * * @param {object} dispatchConfig Dispatch configuration for the event. * @param {object} PluginModule Plugin publishing the event. * @return {boolean} True if the event was successfully published. * @private
(dispatchConfig, pluginModule, eventName)
| 1314 | * @private |
| 1315 | */ |
| 1316 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { |
| 1317 | !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; |
| 1318 | eventNameDispatchConfigs[eventName] = dispatchConfig; |
| 1319 | |
| 1320 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
| 1321 | if (phasedRegistrationNames) { |
| 1322 | for (var phaseName in phasedRegistrationNames) { |
| 1323 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { |
| 1324 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; |
| 1325 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); |
| 1326 | } |
| 1327 | } |
| 1328 | return true; |
| 1329 | } else if (dispatchConfig.registrationName) { |
| 1330 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); |
| 1331 | return true; |
| 1332 | } |
| 1333 | return false; |
| 1334 | } |
| 1335 | |
| 1336 | /** |
| 1337 | * Publishes a registration name that is used to identify dispatched events. |
no test coverage detected