API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classOffscreenPlatform
The PlatformAdapter for a render surface with no document around it: an `OffscreenCanvas`, whether it stayed on the main thread or was transferred into a worker. What it provides on its own is everything that needs no DOM - the host's monotonic clock, frame scheduling, and the surface's backing-store size. Everything else is fed in by whoever owns the document: pointer and key events through OffscreenPlatform.emitSurfaceEvent and OffscreenPlatform.emitWindowEvent, the surface's on-screen rect through OffscreenPlatform.setSurfaceRect, and visibility, focus and gamepads through their setters. Nothing is invented: with no host feeding it, the adapter reports a visible, unfocused surface receiving no input. The affordances that act on a document - focus, cursor, touch-action, pointer capture - do nothing here, and deliberately do not throw. They are mechanisms whose absence degrades the experience rather than breaking the application, exactly as they already do on a browser host that refuses pointer capture, and an application should not have to know which kind of surface it draws into before it can ask for a cursor. Frame scheduling uses the realm's own `requestAnimationFrame` where there is one. A dedicated worker generally has none, so the adapter falls back to a timer at approximately 60 Hz. That fallback is not display-synchronised; a worker-hosted renderer that must not tear should be driven by frames the document's host forwards instead.
import { OffscreenPlatform } from '@codexo/exojs'The PlatformAdapter for a render surface with no document around it: an `OffscreenCanvas`, whether it stayed on the main thread or was transferred into a worker.
What it provides on its own is everything that needs no DOM - the host's monotonic clock, frame scheduling, and the surface's backing-store size. Everything else is fed in by whoever owns the document: pointer and key events through OffscreenPlatform.emitSurfaceEvent and OffscreenPlatform.emitWindowEvent, the surface's on-screen rect through OffscreenPlatform.setSurfaceRect, and visibility, focus and gamepads through their setters. Nothing is invented: with no host feeding it, the adapter reports a visible, unfocused surface receiving no input.
The affordances that act on a document - focus, cursor, touch-action, pointer capture - do nothing here, and deliberately do not throw. They are mechanisms whose absence degrades the experience rather than breaking the application, exactly as they already do on a browser host that refuses pointer capture, and an application should not have to know which kind of surface it draws into before it can ask for a cursor.
Frame scheduling uses the realm's own `requestAnimationFrame` where there is one. A dedicated worker generally has none, so the adapter falls back to a timer at approximately 60 Hz. That fallback is not display-synchronised; a worker-hosted renderer that must not tear should be driven by frames the document's host forwards instead.
cancelFrame(handle: number): voiddestroy(): voidemitSurfaceEvent(type: K, event: PlatformEventDataThe data half of a platform event: every field, none of the suppression calls. Structured-cloneable, so this is the shape an event takes when it has to cross a…<PlatformSurfaceEventMapEvents the input pipeline sources from the drawing surface itself. The payload types are the browser's event shapes, narrowed to the fields the engine reads. K…[K]>): booleanemitWindowEvent(type: K, event: PlatformEventDataThe data half of a platform event: every field, none of the suppression calls. Structured-cloneable, so this is the shape an event takes when it has to cross a…<PlatformWindowEventMapEvents the input pipeline sources from the host window rather than the surface.[K]>): booleannow(): numberonNetworkHintChange(listener: (hint: NetworkHintWhat a host reports about network reachability. `'unknown'` is an answer, not a missing one: a host that cannot say whether a network exists is genuinely not s…) => void): PlatformSubscriptionUndo function returned by every `PlatformAdapter` subscription. Calling it twice is a no-op.onPixelRatioChange(listener: (ratio: number) => void): PlatformSubscriptionUndo function returned by every `PlatformAdapter` subscription. Calling it twice is a no-op.onPointerLockChange(_listener: (locked: boolean) => void): PlatformSubscriptionUndo function returned by every `PlatformAdapter` subscription. Calling it twice is a no-op.onSurfaceEvent(type: K, listener: (event: PlatformSurfaceEventMapEvents the input pipeline sources from the drawing surface itself. The payload types are the browser's event shapes, narrowed to the fields the engine reads. K…[K]) => void): PlatformSubscriptionUndo function returned by every `PlatformAdapter` subscription. Calling it twice is a no-op.onVisibilityChange(listener: (visible: boolean) => void): PlatformSubscriptionUndo function returned by every `PlatformAdapter` subscription. Calling it twice is a no-op.onWindowEvent(type: K, listener: (event: PlatformWindowEventMapEvents the input pipeline sources from the host window rather than the surface.[K]) => void): PlatformSubscriptionUndo function returned by every `PlatformAdapter` subscription. Calling it twice is a no-op.requestFrame(callback: (timestamp: number) => void): numbersetGamepads(gamepads: readonly GamepadOne of four stable gamepad slots. Lives for the entire `Application` lifetime even when no physical pad is attached - a "mailbox" that physical hardware moves… | null[]): voidsetPixelRatio(ratio: number): voidsetSurfaceFocused(focused: boolean): voidsetSurfaceRect(rect: OffscreenSurfaceRectWhere the surface is displayed, in the coordinate space the forwarded pointer events use.): voidsetVisible(visible: boolean): voidcapturePointer: () => voidfocusSurface: () => voidlockPointer: () => voidpointerLocked: falsereleasePointer: () => voidsetCursor: () => voidsetTouchAction: () => voidtextInputFocused: falseunlockPointer: () => voiddevicePixelRatio: numberdocumentVisible: booleansurfaceFocused: boolean