* 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)
| 1186 | * @private |
| 1187 | */ |
| 1188 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { |
| 1189 | !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; |
| 1190 | eventNameDispatchConfigs[eventName] = dispatchConfig; |
| 1191 | |
| 1192 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
| 1193 | if (phasedRegistrationNames) { |
| 1194 | for (var phaseName in phasedRegistrationNames) { |
| 1195 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { |
| 1196 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; |
| 1197 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); |
| 1198 | } |
| 1199 | } |
| 1200 | return true; |
| 1201 | } else if (dispatchConfig.registrationName) { |
| 1202 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); |
| 1203 | return true; |
| 1204 | } |
| 1205 | return false; |
| 1206 | } |
| 1207 | |
| 1208 | /** |
| 1209 | * Publishes a registration name that is used to identify dispatched events. |
no test coverage detected