Core guide
Svelte 5 bridge
Connect game state and typed commands to Svelte without coupling core to Svelte.
Live example
See Svelte 5 bridge in action
Use the focused Svelte example to observe readonly state snapshots and invoke typed commands.
How it works
The adapter owns one game instance and publishes readonly views. Commands preserve synchronous or asynchronous return types, and unmounting disposes subscriptions and the game.
Public types
GameBridge<State, Commands>GameAdapterView<State, Commands>GameHostcreate_game_adapter
Minimum viable example
const bridge = create_game_adapter({
initial_state: { score: 0 },
commands: { increment: (amount: number) => score += amount },
create: ({ publish, canvas }) => create_game({ canvas, publish }),
}); Scope and limitations
Core remains Svelte-independent; scene-owned UI is available through the optional Svelte Game host, while richer reactive helpers are deferred.