* 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)
| 2194 | * @see {EventPluginHub.injection.injectEventPluginsByName} |
| 2195 | */ |
| 2196 | function injectEventPluginsByName(injectedNamesToPlugins) { |
| 2197 | var isOrderingDirty = false; |
| 2198 | for (var pluginName in injectedNamesToPlugins) { |
| 2199 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { |
| 2200 | continue; |
| 2201 | } |
| 2202 | var pluginModule = injectedNamesToPlugins[pluginName]; |
| 2203 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { |
| 2204 | !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0; |
| 2205 | namesToPlugins[pluginName] = pluginModule; |
| 2206 | isOrderingDirty = true; |
| 2207 | } |
| 2208 | } |
| 2209 | if (isOrderingDirty) { |
| 2210 | recomputePluginOrdering(); |
| 2211 | } |
| 2212 | } |
| 2213 | |
| 2214 | var EventPluginRegistry = Object.freeze({ |
| 2215 | plugins: plugins, |
nothing calls this directly
no test coverage detected