Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

fumo:events

fumo:events owns persistent callbacks. Callbacks execute on FumoEngine’s serialized script lane: createMove is pumped by the command hook and render is pumped by the view-render frame-start hook, never from Present.

import { events } from "fumo:events";

const unsubscribe = events.on("render", ({ displaySize, deltaTime }) => {
    console.log(displaySize.width, deltaTime);
});

events.once("mapLoad", ({ map }) => {
    console.log("Loaded", map);
});

events.on() and events.once() return an unsubscribe function. events.off accepts a numeric subscription ID for low-level integrations, although normal scripts should retain and call the returned function.

Implemented host events:

EventPayload
loadundefined
shutdownundefined
createMove{ displaySize, deltaTime }
render{ displaySize, deltaTime }
mapLoad{ map, value }
mapUnload{ map, value }
menuOpenChanged{ value: "true" | "false" }
configLoaded{ value }

frameStage, gameEvent, and input are reserved subscription names. Their native bridges are not emitted yet.

Each callback has an 8 ms hard execution deadline. Exceptions are written to the JavaScript console and do not unwind through the game hook.