MCPcopy Index your code
hub / github.com/krasimir/react-in-patterns / publishEventForPlugin

Function publishEventForPlugin

code/new-context-api/public/app.js:1316–1334  ·  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

1314 * @private
1315 */
1316function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
1317 !!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
1318 eventNameDispatchConfigs[eventName] = dispatchConfig;
1319
1320 var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
1321 if (phasedRegistrationNames) {
1322 for (var phaseName in phasedRegistrationNames) {
1323 if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
1324 var phasedRegistrationName = phasedRegistrationNames[phaseName];
1325 publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
1326 }
1327 }
1328 return true;
1329 } else if (dispatchConfig.registrationName) {
1330 publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
1331 return true;
1332 }
1333 return false;
1334}
1335
1336/**
1337 * 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