Riskless/static/js/player.js

21 lines
449 B
JavaScript

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);
}
}