aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/services/event-bus.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/services/event-bus.service.ts')
-rw-r--r--catalog-ui/src/app/ng2/services/event-bus.service.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/catalog-ui/src/app/ng2/services/event-bus.service.ts b/catalog-ui/src/app/ng2/services/event-bus.service.ts
index 7730a77f41..438437d193 100644
--- a/catalog-ui/src/app/ng2/services/event-bus.service.ts
+++ b/catalog-ui/src/app/ng2/services/event-bus.service.ts
@@ -11,6 +11,18 @@ export class EventBusService extends BasePubSub {
protected handlePluginRegistration(eventData: IPubSubEvent, event: any) {
if (eventData.type === 'PLUGIN_REGISTER') {
this.register(eventData.data.pluginId, event.source, event.origin);
+
+ let newEventsList = [];
+
+ if (this.eventsToWait.has(eventData.data.pluginId)) {
+ newEventsList = _.union(this.eventsToWait.get(eventData.data.pluginId), eventData.data.eventsToWait);
+ }
+ else {
+ newEventsList = eventData.data.eventsToWait;
+ }
+
+ this.eventsToWait.set(eventData.data.pluginId, newEventsList);
+
} else if (eventData.type === 'PLUGIN_UNREGISTER') {
this.unregister(eventData.data.pluginId);
}
@@ -21,8 +33,9 @@ export class EventBusService extends BasePubSub {
pluginId: pluginId
};
- this.notify('PLUGIN_CLOSE', unregisterData);
- super.unregister(pluginId);
+ this.notify('PLUGIN_CLOSE', unregisterData).subscribe(() => {
+ super.unregister(pluginId);
+ });
}
protected onMessage(event: any) {