2019-09-25 18:26:39 +02:00
|
|
|
import * as plugins from './smartuniverse.plugins';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* broadcasts an event to multiple channels
|
2019-11-10 16:55:17 +01:00
|
|
|
* also handles subsription
|
2019-09-25 18:26:39 +02:00
|
|
|
*/
|
2019-11-10 16:55:17 +01:00
|
|
|
export class BroadcastEvent<T extends plugins.typedrequestInterfaces.IBroadCastEvent<any>> {
|
|
|
|
public eventSubject = new plugins.smartrx.rxjs.Subject<T['payload']>();
|
|
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
public fire(eventArg: T['payload']) {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public subscribe(funcArg: (nextArg: T['payload']) => void): plugins.smartrx.rxjs.Subscription {
|
|
|
|
return this.eventSubject.subscribe(funcArg);
|
|
|
|
}
|
2019-11-09 13:00:30 +01:00
|
|
|
}
|