smartuniverse/ts/smartuniverse.classes.event.broadcastevent.ts

18 lines
520 B
TypeScript
Raw Permalink Normal View History

2019-09-25 16:26:39 +00:00
import * as plugins from './smartuniverse.plugins';
/**
* broadcasts an event to multiple channels
2020-09-29 19:39:13 +00:00
* also handles subscription
2019-09-25 16:26:39 +00:00
*/
2020-09-24 18:13:48 +00:00
export class BroadcastEvent<T extends plugins.typedrequestInterfaces.ITypedEvent<any>> {
2019-11-10 15:55:17 +00:00
public eventSubject = new plugins.smartrx.rxjs.Subject<T['payload']>();
2020-09-24 18:17:52 +00:00
constructor() {}
2019-11-10 15:55:17 +00:00
2020-09-24 18:17:52 +00:00
public fire(eventPayloadArg: T['payload']) {}
2019-11-10 15:55:17 +00:00
public subscribe(funcArg: (nextArg: T['payload']) => void): plugins.smartrx.rxjs.Subscription {
return this.eventSubject.subscribe(funcArg);
}
2019-11-09 12:00:30 +00:00
}