INNER CODE UNIT · TypeScript
handler
voxelize/voxelize · packages/core/src/core/network/index.ts:898
const handler = (e: MessageEvent) => {
priorityWorker.removeEventListener("message", handler);
if (!this.connected) {
// Never discard a possible INIT: the join handshake would wedge with
// `waitingForInit` stuck. Re-queue it; a real teardown clears the
// queue anyway.
this.enqueuePacket(buffer);
return;
}
const messages = e.data as MessageProtocol[];
const decoded = messages[0];
if (
(decoded.type === "INIT" || decoded.type === "ERROR") &&
this.waitingForInit
) {