rkgk/static/online-users.js

20 lines
354 B
JavaScript
Raw Normal View History

2024-08-10 23:13:20 +02:00
export class OnlineUsers extends EventTarget {
#users = new Map();
constructor() {
super();
}
addUser(sessionId, userInfo) {
this.#users.set(sessionId, userInfo);
}
getUser(sessionId) {
return this.#users.get(sessionId);
}
removeUser(sessionId) {
this.#users.delete(sessionId);
}
}