Riskless/static/js/player.js

21 lines
449 B
JavaScript
Raw Normal View History

2023-01-31 12:34:13 +00:00
class Player {
2023-01-29 16:47:37 +00:00
constructor(id, name) {
this.name = name;
this.timeout = null;
this.id = id;
this.ready = false;
this.isPlaying = false;
2023-01-29 16:47:37 +00:00
}
resetTimeout() {
if (this.timeout !== null) {
2023-01-31 12:34:13 +00:00
window.clearTimeout(this.timeout);
2023-01-29 16:47:37 +00:00
}
this.timeout = window.setTimeout(() => {
delete players[this.id];
updatePlayerDom();
}, TIMEOUT);
}
}