1 import { BasePubSub } from './base-pubsub';
3 declare const window: Window;
5 export class PluginPubSub extends BasePubSub {
7 constructor(pluginId: string, parentUrl: string, eventsToWait?: string[]) {
9 this.register('sdc-hub', window.parent, parentUrl);
10 this.subscribe(eventsToWait);
13 public subscribe(eventsToWait?: string[]) {
14 const registerData = {
15 pluginId: this.clientId,
16 eventsToWait: eventsToWait || []
19 this.notify('PLUGIN_REGISTER', registerData);
22 public unsubscribe() {
23 const unregisterData = {
24 pluginId: this.clientId
27 this.notify('PLUGIN_UNREGISTER', unregisterData);