16 lines
256 B
TypeScript
Raw Normal View History

2022-08-14 13:21:34 -05:00
import { joinRoom, Room } from 'trystero'
2022-08-13 12:11:59 -05:00
export class PeerRoom {
2022-08-14 13:21:34 -05:00
private room?: Room
2022-08-13 12:11:59 -05:00
2022-08-14 10:10:05 -05:00
joinRoom(appId: string, roomId: string) {
this.room = joinRoom({ appId }, roomId)
2022-08-13 12:11:59 -05:00
}
leaveRoom() {
if (this.room) {
this.room.leave()
}
}
}