Riskless/static/js/player.js

22 lines
485 B
JavaScript
Raw Normal View History

2023-01-29 16:47:37 +00:00
import { updatePlayerDom } from "./dom.js";
export class Player {
constructor(id, name) {
this.name = name;
this.timeout = null;
this.id = id;
this.ready = false;
}
resetTimeout() {
if (this.timeout !== null) {
window.clearTimeout(players[data.author].timeout);
}
this.timeout = window.setTimeout(() => {
delete players[this.id];
updatePlayerDom();
}, TIMEOUT);
}
}