From 6dfd8b366db3aa88362da0f7e7dbf511a583612d Mon Sep 17 00:00:00 2001 From: Vitaly Date: Sat, 23 Sep 2023 03:52:34 +0300 Subject: [PATCH] [doubt] use macrotasks for processing local server data this allow to better simulate env flying squid running in, but ideally shouldn't be used imo the main intention here is too wether it can improve fps stability. I don't really think moving flying squid to web worker would significantly improve performance as I see still most of the time is lost in three.js stuff --- src/customServer.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/customServer.ts b/src/customServer.ts index 682459f4..9f07b6fc 100644 --- a/src/customServer.ts +++ b/src/customServer.ts @@ -6,7 +6,9 @@ window.serverDataChannel ??= {} export const customCommunication = { sendData(data) { //@ts-ignore - window.serverDataChannel[this.isServer ? 'emitClient' : 'emitServer'](data) + setTimeout(() => { + window.serverDataChannel[this.isServer ? 'emitClient' : 'emitServer'](data) + }) }, receiverSetup(processData) { //@ts-ignore