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

Function publishEventForPlugin

code/redux/public/app.js:2206–2224  ·  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

2204 * @private
2205 */
2206function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
2207 !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
2208 eventNameDispatchConfigs[eventName] = dispatchConfig;
2209
2210 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
2211 if (phasedRegistrationNames) {
2212 for (var phaseName in phasedRegistrationNames) {
2213 if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
2214 var phasedRegistrationName = phasedRegistrationNames[phaseName];
2215 publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
2216 }
2217 }
2218 return true;
2219 } else if (dispatchConfig.registrationName) {
2220 publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
2221 return true;
2222 }
2223 return false;
2224}
2225
2226/**
2227 * 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