* 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)
| 1988 | * @private |
| 1989 | */ |
| 1990 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { |
| 1991 | !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0; |
| 1992 | eventNameDispatchConfigs[eventName] = dispatchConfig; |
| 1993 | |
| 1994 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
| 1995 | if (phasedRegistrationNames) { |
| 1996 | for (var phaseName in phasedRegistrationNames) { |
| 1997 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { |
| 1998 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; |
| 1999 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); |
| 2000 | } |
| 2001 | } |
| 2002 | return true; |
| 2003 | } else if (dispatchConfig.registrationName) { |
| 2004 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); |
| 2005 | return true; |
| 2006 | } |
| 2007 | return false; |
| 2008 | } |
| 2009 | |
| 2010 | /** |
| 2011 | * Publishes a registration name that is used to identify dispatched events. |
no test coverage detected