refactor: structure
This commit is contained in:
parent
92b167237d
commit
8eec34fd47
|
@ -2,7 +2,7 @@ import {get, set} from 'idb-keyval';
|
||||||
|
|
||||||
import {encode} from '@/packets/index.js';
|
import {encode} from '@/packets/index.js';
|
||||||
|
|
||||||
import Engine from '../../engine/engine.js';
|
import Engine from '../../engine.js';
|
||||||
import Server from './server.js';
|
import Server from './server.js';
|
||||||
|
|
||||||
class WorkerServer extends Server {
|
class WorkerServer extends Server {
|
||||||
|
@ -52,7 +52,7 @@ onmessage = async (event) => {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
if (import.meta.hot) {
|
if (import.meta.hot) {
|
||||||
import.meta.hot.accept('../../engine/engine.js', async () => {
|
import.meta.hot.accept('../engine/engine.js', async () => {
|
||||||
await engine.disconnectPlayer(0, 0);
|
await engine.disconnectPlayer(0, 0);
|
||||||
postMessage(encode({type: 'ConnectionStatus', payload: 'aborted'}));
|
postMessage(encode({type: 'ConnectionStatus', payload: 'aborted'}));
|
||||||
close();
|
close();
|
||||||
|
|
|
@ -6,7 +6,7 @@ import {WebSocketServer} from 'ws';
|
||||||
import Server from '@/net/server/server.js';
|
import Server from '@/net/server/server.js';
|
||||||
import {getSession} from '@/session.server.js';
|
import {getSession} from '@/session.server.js';
|
||||||
|
|
||||||
import Engine from './engine/engine.js';
|
import Engine from './engine.js';
|
||||||
|
|
||||||
const wss = new WebSocketServer({
|
const wss = new WebSocketServer({
|
||||||
noServer: true,
|
noServer: true,
|
||||||
|
@ -85,7 +85,7 @@ async function remakeServer(Engine) {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
if (import.meta.hot) {
|
if (import.meta.hot) {
|
||||||
import.meta.hot.accept('./engine/engine.js', async ({default: Engine}) => {
|
import.meta.hot.accept('./engine.js', async ({default: Engine}) => {
|
||||||
await remakeServer(Engine);
|
await remakeServer(Engine);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user