refactor: load
This commit is contained in:
parent
9643055fb8
commit
3dc7cf8a5b
|
@ -53,6 +53,9 @@ export default class Server {
|
||||||
this.entities.splice(this.entities.indexOf(entity), 1);
|
this.entities.splice(this.entities.indexOf(entity), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async load() {
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
return setInterval(() => {
|
return setInterval(() => {
|
||||||
const elapsed = (Date.now() - this.last) / 1000;
|
const elapsed = (Date.now() - this.last) / 1000;
|
||||||
|
|
|
@ -12,6 +12,7 @@ const server = new class SocketServer extends Server {
|
||||||
send(ws, data) { ws.send(JSON.stringify(data)); }
|
send(ws, data) { ws.send(JSON.stringify(data)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await server.load();
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
wss.on('connection', function connection(ws) {
|
wss.on('connection', function connection(ws) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ const server = new class WorkerServer extends Server {
|
||||||
send(connection, data) { postMessage(data); }
|
send(connection, data) { postMessage(data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await server.load();
|
||||||
server.start();
|
server.start();
|
||||||
|
|
||||||
server.connectPlayer(undefined);
|
server.connectPlayer(undefined);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user