mirror of
https://github.com/jcreek/EstimationPoker.git
synced 2026-07-12 18:43:47 +00:00
refactor(#35): 3
This commit is contained in:
+17
-4
@@ -10,9 +10,23 @@ export default class EstimationParty implements Party.Server {
|
|||||||
|
|
||||||
constructor(public party: Party.Room) {}
|
constructor(public party: Party.Room) {}
|
||||||
|
|
||||||
function createRoom(roomId: string, cardSetName: string) {
|
async onStart() {
|
||||||
room = new Room(roomId, cardSetName);
|
const savedRoom = (await this.party.storage.get('room')) as Room;
|
||||||
rooms.add(room);
|
this.room = savedRoom ? new Room(savedRoom.id, savedRoom.cardSet.name) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async onConnect(connection: Party.Connection) {
|
||||||
|
if (this.room) {
|
||||||
|
const users = this.room.getUsers();
|
||||||
|
connection.send(
|
||||||
|
JSON.stringify({
|
||||||
|
type: 'sync',
|
||||||
|
roomId: this.room.id,
|
||||||
|
users,
|
||||||
|
cardSetName: this.room.cardSet.name
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ws.on('message', (message) => {
|
ws.on('message', (message) => {
|
||||||
@@ -154,4 +168,3 @@ export default class EstimationParty implements Party.Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user