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