smartuniverse/ts/smartuniverse.classes.broadcastevent.ts

24 lines
528 B
TypeScript
Raw Normal View History

2019-09-25 16:26:39 +00:00
import * as plugins from './smartuniverse.plugins';
/**
* broadcasts an event to multiple channels
2019-11-10 15:55:17 +00:00
* also handles subsription
2019-09-25 16:26:39 +00:00
*/
2019-11-10 15:55:17 +00: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 12:00:30 +00:00
}