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

Function recomputePluginOrdering

code/new-context-api/public/app.js:1287–1306  ·  view source on GitHub ↗

* Recomputes the plugin list using the injected plugins and plugin ordering. * * @private

()

Source from the content-addressed store, hash-verified

1285 * @private
1286 */
1287function recomputePluginOrdering() {
1288 if (!eventPluginOrder) {
1289 // Wait until an `eventPluginOrder` is injected.
1290 return;
1291 }
1292 for (var pluginName in namesToPlugins) {
1293 var pluginModule = namesToPlugins[pluginName];
1294 var pluginIndex = eventPluginOrder.indexOf(pluginName);
1295 !(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
1296 if (plugins[pluginIndex]) {
1297 continue;
1298 }
1299 !pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
1300 plugins[pluginIndex] = pluginModule;
1301 var publishedEvents = pluginModule.eventTypes;
1302 for (var eventName in publishedEvents) {
1303 !publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
1304 }
1305 }
1306}
1307
1308/**
1309 * Publishes an event so that it can be dispatched by the supplied plugin.

Callers 2

injectEventPluginOrderFunction · 0.70
injectEventPluginsByNameFunction · 0.70

Calls 2

invariantFunction · 0.70
publishEventForPluginFunction · 0.70

Tested by

no test coverage detected