* 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)
| 2056 | * @see {EventPluginHub.injection.injectEventPluginsByName} |
| 2057 | */ |
| 2058 | function injectEventPluginsByName(injectedNamesToPlugins) { |
| 2059 | var isOrderingDirty = false; |
| 2060 | for (var pluginName in injectedNamesToPlugins) { |
| 2061 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { |
| 2062 | continue; |
| 2063 | } |
| 2064 | var pluginModule = injectedNamesToPlugins[pluginName]; |
| 2065 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { |
| 2066 | !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0; |
| 2067 | namesToPlugins[pluginName] = pluginModule; |
| 2068 | isOrderingDirty = true; |
| 2069 | } |
| 2070 | } |
| 2071 | if (isOrderingDirty) { |
| 2072 | recomputePluginOrdering(); |
| 2073 | } |
| 2074 | } |
| 2075 | |
| 2076 | var EventPluginRegistry = Object.freeze({ |
| 2077 | plugins: plugins, |
nothing calls this directly
no test coverage detected