* 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)
| 2091 | * @private |
| 2092 | */ |
| 2093 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { |
| 2094 | !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; |
| 2095 | eventNameDispatchConfigs[eventName] = dispatchConfig; |
| 2096 | |
| 2097 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
| 2098 | if (phasedRegistrationNames) { |
| 2099 | for (var phaseName in phasedRegistrationNames) { |
| 2100 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { |
| 2101 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; |
| 2102 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); |
| 2103 | } |
| 2104 | } |
| 2105 | return true; |
| 2106 | } else if (dispatchConfig.registrationName) { |
| 2107 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); |
| 2108 | return true; |
| 2109 | } |
| 2110 | return false; |
| 2111 | } |
| 2112 | |
| 2113 | /** |
| 2114 | * Publishes a registration name that is used to identify dispatched events. |
no test coverage detected