20 lines
417 B
JavaScript
20 lines
417 B
JavaScript
class Player {
|
|
constructor(id, name) {
|
|
this.name = name;
|
|
this.timeout = null;
|
|
this.id = id;
|
|
this.ready = false;
|
|
}
|
|
|
|
resetTimeout() {
|
|
if (this.timeout !== null) {
|
|
window.clearTimeout(this.timeout);
|
|
}
|
|
|
|
this.timeout = window.setTimeout(() => {
|
|
delete players[this.id];
|
|
updatePlayerDom();
|
|
}, TIMEOUT);
|
|
}
|
|
}
|