Host globals
Globals provided by the host runtime itself (web viewer, iOS, Android, desktop) rather than injected by the SDK. Available in every project, in every engine.
The frame loop
setLoop(fn: (dt: number) => void): number
clearLoop(id: number): voidFires every rendered frame. dt is seconds since the previous frame (~0.016 at 60 fps) — for
frame-independent motion, scale by it: position += speed * dt.
const id = setLoop(dt => {
if (Input.key('ArrowRight')) player.x += 120 * dt
})a loop keeps running until cleared. Anything started in a screen's onOpen must be
stopped in its onClose, or it leaks across navigation.
Timers
setTimeout(fn, ms?): number
setInterval(fn, ms?): number
clearTimeout(id): void
clearInterval(id): voidSame semantics as the web, milliseconds. (Contrast: setLoop's dt is seconds.)
Console
console.log(...data) / console.warn(...) / console.info(...) / console.error(...)The only console methods that exist — no console.table, console.time, etc.
asset() — project resources
asset(path: string): string // compile-time macro — path must be a string LITERALRewritten by the bundler into the resource import for that file; the returned string is the bundled asset URL. Equivalent to importing the file:
import hero from './hero.png' // same thing
const tex = await Texture2D.load(asset('./hero.png'))because it's a macro, asset(someVariable) is a build error. Remote https://…
URLs don't need it — pass them as plain strings.
Angle constants
DEG2RAD // π / 180 — substituted at compile time
RAD2DEG // 180 / πUse them at the radians↔degrees boundary (see conventions).
Style<T> (editor-only type)
const preset: Style<UIButton> = { bgColor: '#333', borderRadius: 12 }Resolves to the partial style object el.style(...) accepts — for typing reusable style presets.
A pure type: no runtime existence.