* 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)
| 1289 | * @see {EventPluginHub.injection.injectEventPluginsByName} |
| 1290 | */ |
| 1291 | function injectEventPluginsByName(injectedNamesToPlugins) { |
| 1292 | var isOrderingDirty = false; |
| 1293 | for (var pluginName in injectedNamesToPlugins) { |
| 1294 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { |
| 1295 | continue; |
| 1296 | } |
| 1297 | var pluginModule = injectedNamesToPlugins[pluginName]; |
| 1298 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { |
| 1299 | !!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0; |
| 1300 | namesToPlugins[pluginName] = pluginModule; |
| 1301 | isOrderingDirty = true; |
| 1302 | } |
| 1303 | } |
| 1304 | if (isOrderingDirty) { |
| 1305 | recomputePluginOrdering(); |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | var EventPluginRegistry = Object.freeze({ |
| 1310 | plugins: plugins, |
nothing calls this directly
no test coverage detected