MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / publishEventForPlugin

Function publishEventForPlugin

code/composition/public/app.js:2093–2111  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

2091 * @private
2092 */
2093function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
2094 !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
2095 eventNameDispatchConfigs[eventName] = dispatchConfig;
2096
2097 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
2098 if (phasedRegistrationNames) {
2099 for (var phaseName in phasedRegistrationNames) {
2100 if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
2101 var phasedRegistrationName = phasedRegistrationNames[phaseName];
2102 publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
2103 }
2104 }
2105 return true;
2106 } else if (dispatchConfig.registrationName) {
2107 publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
2108 return true;
2109 }
2110 return false;
2111}
2112
2113/**
2114 * Publishes a registration name that is used to identify dispatched events.

Callers 1

recomputePluginOrderingFunction · 0.70

Calls 2

invariantFunction · 0.70
publishRegistrationNameFunction · 0.70

Tested by

no test coverage detected