v0.7.1 (build 925)

The Standard Library is a set of JavaScript modules shipped with Koya under /rom/std/. They wrap the low-level Helix/* and Koya/* engine APIs into ergonomic, object-oriented classes so you can build applications faster and with less boilerplate.

Modules #

  • koya-ui — Window and Element classes that wrap Koya/Compositor and Helix/UserInterface. Also re-exports controls.
  • koya-controls — Ready-made interactive controls: InputText (single-line text input), Button (animation-driven button), and ScrollView (native kinetic scrolling).
  • Store — Lightweight reactive data store with deep proxy observation and path-based subscriptions.

Usage #

Import from the /rom/std/ prefix. The standard library modules are available to any Koya script without extra installation.

import { Window, Element } from '/rom/std/koya-ui.js';
import { InputText, Button, ScrollView, blurAll } from '/rom/std/koya-controls.js';
import Store from '/rom/std/store.js';

koya-ui.js re-exports the controls, so you can also import everything from a single module:

import { Window, Element, InputText, Button, ScrollView, blurAll } from '/rom/std/koya-ui.js';

Relationship to engine APIs #

The standard library is purely JavaScript; it calls through to the same Koya/Compositor, Helix/UserInterface, and Helix/Event bindings documented in the Koya section. You can freely mix standard library objects with raw engine calls — window.id and element.id give you the numeric handles the engine expects.

Note

All standard library methods that touch the engine are async. Use await consistently, just as you would with the raw Helix/* and Koya/* APIs.