* 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)
| 503 | |
| 504 | |
| 505 | function publishEventForPlugin(dispatchConfig, pluginModule, eventName) { |
| 506 | if (!!eventNameDispatchConfigs.hasOwnProperty(eventName)) { |
| 507 | { |
| 508 | throw Error( "EventPluginRegistry: More than one plugin attempted to publish the same event name, `" + eventName + "`." ); |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | eventNameDispatchConfigs[eventName] = dispatchConfig; |
| 513 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; |
| 514 | |
| 515 | if (phasedRegistrationNames) { |
| 516 | for (var phaseName in phasedRegistrationNames) { |
| 517 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) { |
| 518 | var phasedRegistrationName = phasedRegistrationNames[phaseName]; |
| 519 | publishRegistrationName(phasedRegistrationName, pluginModule, eventName); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | return true; |
| 524 | } else if (dispatchConfig.registrationName) { |
| 525 | publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName); |
| 526 | return true; |
| 527 | } |
| 528 | |
| 529 | return false; |
| 530 | } |
| 531 | /** |
| 532 | * Publishes a registration name that is used to identify dispatched events. |
| 533 | * |
no test coverage detected