* Injects plugins to be used by plugin event system. 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.
(injectedNamesToPlugins)
| 621 | */ |
| 622 | |
| 623 | function injectEventPluginsByName(injectedNamesToPlugins) { |
| 624 | var isOrderingDirty = false; |
| 625 | |
| 626 | for (var pluginName in injectedNamesToPlugins) { |
| 627 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { |
| 628 | continue; |
| 629 | } |
| 630 | |
| 631 | var pluginModule = injectedNamesToPlugins[pluginName]; |
| 632 | |
| 633 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) { |
| 634 | if (!!namesToPlugins[pluginName]) { |
| 635 | { |
| 636 | throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + pluginName + "`." ); |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | namesToPlugins[pluginName] = pluginModule; |
| 641 | isOrderingDirty = true; |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | if (isOrderingDirty) { |
| 646 | recomputePluginOrdering(); |
| 647 | } |
| 648 | } |
| 649 | |
| 650 | var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); |
| 651 |
no test coverage detected