diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/components/ui')
-rw-r--r-- | catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts index 2ba784727f..4759721034 100644 --- a/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts +++ b/catalog-ui/src/app/ng2/components/ui/plugin/plugin-frame.component.ts @@ -43,13 +43,16 @@ export class PluginFrameComponent implements OnInit { this.pluginUrl += this.urlSearchParams.toString(); } - this.eventBusService.on((eventData) => { + let readyEvent = (eventData) => { if (eventData.originId === this.plugin.pluginId) { if (eventData.type == "READY") { this.onLoadingDone.emit(); + this.eventBusService.off(readyEvent) } } - }); + }; + + this.eventBusService.on(readyEvent); // Listening to the stateChangeStart event in order to notify the plugin about it being closed // before moving to a new state @@ -58,11 +61,11 @@ export class PluginFrameComponent implements OnInit { if (!this.isClosed) { event.preventDefault(); - this.eventBusService.notify("WINDOW_OUT"); + this.eventBusService.notify("WINDOW_OUT").subscribe(() => { + this.isClosed = true; - this.isClosed = true; + this.eventBusService.unregister(this.plugin.pluginId); - setTimeout(() => { this.$state.go(toState.name, toParams); }); } |