* 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)
| 1953 | * @private |
| 1954 | */ |
| 1955 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { |
| 1956 | !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; |
| 1957 | eventNameDispatchConfigs[eventName] = dispatchConfig; |
| 1958 | |
| 1959 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
| 1960 | if (phasedRegistrationNames) { |
| 1961 | for (var phaseName in phasedRegistrationNames) { |
| 1962 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { |
| 1963 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; |
| 1964 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); |
| 1965 | } |
| 1966 | } |
| 1967 | return true; |
| 1968 | } else if (dispatchConfig.registrationName) { |
| 1969 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); |
| 1970 | return true; |
| 1971 | } |
| 1972 | return false; |
| 1973 | } |
| 1974 | |
| 1975 | /** |
| 1976 | * Publishes a registration name that is used to identify dispatched events. |
no test coverage detected