* 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)
| 2091 | * @see {EventPluginHub.injection.injectEventPluginsByName} |
| 2092 | */ |
| 2093 | function injectEventPluginsByName(injectedNamesToPlugins) { |
| 2094 | var isOrderingDirty = false; |
| 2095 | for (var pluginName in injectedNamesToPlugins) { |
| 2096 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { |
| 2097 | continue; |
| 2098 | } |
| 2099 | var pluginModule = injectedNamesToPlugins[pluginName]; |
| 2100 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { |
| 2101 | !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0; |
| 2102 | namesToPlugins[pluginName] = pluginModule; |
| 2103 | isOrderingDirty = true; |
| 2104 | } |
| 2105 | } |
| 2106 | if (isOrderingDirty) { |
| 2107 | recomputePluginOrdering(); |
| 2108 | } |
| 2109 | } |
| 2110 | |
| 2111 | var EventPluginRegistry = Object.freeze({ |
| 2112 | plugins: plugins, |
nothing calls this directly
no test coverage detected