* Injects plugins to be used by `EventPluginHub`. The plugin names must be * in the ordering injected by `injectEventPluginOrder`. * * Plugins can be injected as part of page initialization or on-the-fly. * * @param {object} injectedNamesToPlugins Map from names to plugin modules. * @internal
(injectedNamesToPlugins)
| 1417 | * @see {EventPluginHub.injection.injectEventPluginsByName} |
| 1418 | */ |
| 1419 | function injectEventPluginsByName(injectedNamesToPlugins) { |
| 1420 | var isOrderingDirty = false; |
| 1421 | for (var pluginName in injectedNamesToPlugins) { |
| 1422 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { |
| 1423 | continue; |
| 1424 | } |
| 1425 | var pluginModule = injectedNamesToPlugins[pluginName]; |
| 1426 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { |
| 1427 | !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0; |
| 1428 | namesToPlugins[pluginName] = pluginModule; |
| 1429 | isOrderingDirty = true; |
| 1430 | } |
| 1431 | } |
| 1432 | if (isOrderingDirty) { |
| 1433 | recomputePluginOrdering(); |
| 1434 | } |
| 1435 | } |
| 1436 | |
| 1437 | var EventPluginRegistry = Object.freeze({ |
| 1438 | plugins: plugins, |
nothing calls this directly
no test coverage detected