* 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)
| 2046 | * @private |
| 2047 | */ |
| 2048 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { |
| 2049 | !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; |
| 2050 | eventNameDispatchConfigs[eventName] = dispatchConfig; |
| 2051 | |
| 2052 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
| 2053 | if (phasedRegistrationNames) { |
| 2054 | for (var phaseName in phasedRegistrationNames) { |
| 2055 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { |
| 2056 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; |
| 2057 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); |
| 2058 | } |
| 2059 | } |
| 2060 | return true; |
| 2061 | } else if (dispatchConfig.registrationName) { |
| 2062 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); |
| 2063 | return true; |
| 2064 | } |
| 2065 | return false; |
| 2066 | } |
| 2067 | |
| 2068 | /** |
| 2069 | * Publishes a registration name that is used to identify dispatched events. |
no test coverage detected