* 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)
| 2204 | * @private |
| 2205 | */ |
| 2206 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { |
| 2207 | !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; |
| 2208 | eventNameDispatchConfigs[eventName] = dispatchConfig; |
| 2209 | |
| 2210 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
| 2211 | if (phasedRegistrationNames) { |
| 2212 | for (var phaseName in phasedRegistrationNames) { |
| 2213 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { |
| 2214 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; |
| 2215 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); |
| 2216 | } |
| 2217 | } |
| 2218 | return true; |
| 2219 | } else if (dispatchConfig.registrationName) { |
| 2220 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); |
| 2221 | return true; |
| 2222 | } |
| 2223 | return false; |
| 2224 | } |
| 2225 | |
| 2226 | /** |
| 2227 | * Publishes a registration name that is used to identify dispatched events. |
no test coverage detected