Pixi’VN
indexType aliases

Type Alias: GameWorkerRequest

> GameWorkerRequest = { diff: Difference[]; id: number; state: object; type: "restore-diff"; } | { after: object; before: object; id: number; type: "diff"; } | { id: number; type: "clone"; value: object; } | { id: number; kind: string; payload: unknown; type: "custom"; }

Defined in: src/worker/interfaces/GameWorkerMessage.ts:13

Message protocol between the main thread and an optional GameWorker-registered Worker. Kept intentionally small: each request names one unit of work Pixi'VN (or a third-party library building on it, via "custom" - see registerGameWorkerHandler) knows how to hand off, and the worker replies with the same id so the caller can match the response.

This protocol (and everything it carries) only ever deals with plain, structured-clone-safe data - never PixiJS/canvas/audio objects, which can't leave the main thread.

Union Members

Type Literal

{ diff: Difference[]; id: number; state: object; type: "restore-diff"; }

diff

> diff: Difference[]

id

> id: number

state

> state: object

The base state to apply diff to (not mutated).

type

> type: "restore-diff"


Type Literal

{ after: object; before: object; id: number; type: "diff"; }

after

> after: object

before

> before: object

The two states to compare (neither is mutated).

id

> id: number

type

> type: "diff"


Type Literal

{ id: number; type: "clone"; value: object; }

id

> id: number

type

> type: "clone"

value

> value: object

The value to deep-clone.


Type Literal

{ id: number; kind: string; payload: unknown; type: "custom"; }

id

> id: number

kind

> kind: string

Identifies which registered handler (see registerGameWorkerHandler) should run.

payload

> payload: unknown

type

> type: "custom"

On this page