partey_workadventure/front/src/Connexion/EmoteEventStream.ts

18 lines
384 B
TypeScript
Raw Normal View History

2021-09-06 14:27:54 +02:00
import { Subject } from "rxjs";
interface EmoteEvent {
2021-09-06 14:27:54 +02:00
userId: number;
emote: string;
}
class EmoteEventStream {
2021-09-06 14:27:54 +02:00
private _stream: Subject<EmoteEvent> = new Subject();
public stream = this._stream.asObservable();
fire(userId: number, emote: string) {
this._stream.next({ userId, emote });
}
}
2021-09-06 14:27:54 +02:00
export const emoteEventStream = new EmoteEventStream();