* Recomputes the plugin list using the injected plugins and plugin ordering. * * @private
()
| 455 | */ |
| 456 | |
| 457 | function recomputePluginOrdering() { |
| 458 | if (!eventPluginOrder) { |
| 459 | // Wait until an `eventPluginOrder` is injected. |
| 460 | return; |
| 461 | } |
| 462 | |
| 463 | for (var pluginName in namesToPlugins) { |
| 464 | var pluginModule = namesToPlugins[pluginName]; |
| 465 | var pluginIndex = eventPluginOrder.indexOf(pluginName); |
| 466 | |
| 467 | if (!(pluginIndex > -1)) { |
| 468 | { |
| 469 | throw Error( "EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `" + pluginName + "`." ); |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | if (plugins[pluginIndex]) { |
| 474 | continue; |
| 475 | } |
| 476 | |
| 477 | if (!pluginModule.extractEvents) { |
| 478 | { |
| 479 | throw Error( "EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `" + pluginName + "` does not." ); |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | plugins[pluginIndex] = pluginModule; |
| 484 | var publishedEvents = pluginModule.eventTypes; |
| 485 | |
| 486 | for (var eventName in publishedEvents) { |
| 487 | if (!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName)) { |
| 488 | { |
| 489 | throw Error( "EventPluginRegistry: Failed to publish event `" + eventName + "` for plugin `" + pluginName + "`." ); |
| 490 | } |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | /** |
| 496 | * Publishes an event so that it can be dispatched by the supplied plugin. |
| 497 | * |
no test coverage detected