A2UI-Oat Function Demo

Live validation of all 22 registered functions. Import path: ../../renderer/index.js

Formatting

formatDate

Locale-aware date formatting via Intl.DateTimeFormat.




formatNumber

Locale-aware number formatting via Intl.NumberFormat.




formatCurrency

Currency formatting via Intl.NumberFormat with ISO 4217 codes.




formatString

Interpolates ${/path} references from a data model.


Data model: { user: { name: "Alice" }, inbox: { count: 7 } }

pluralize

Returns singular or plural form based on count.




Validation

required

Returns true if value is non-null and non-empty.


regex

Validates value against a regular expression pattern.



length

Validates that string length falls within min/max bounds.




numeric

Returns true if value is a valid number.


email

Validates email address format using /^[^\s@]+@[^\s@]+\.[^\s@]+$/.


Logic

and

Returns true if ALL conditions are truthy.




or

Returns true if ANY condition is truthy.




not

Returns the logical NOT of a value.


Actions

navigateTo

SPA navigation via History API (pushState + popstate event).


openUrl

Opens a URL in a new browser tab.


showToast

Displays a toast notification using Oat data-attributes.




debounce

Delays dispatching a targetAction until a quiet period expires (default 300 ms). Used in A2UI context with dispatchAction. Type below to see the timer in action.

debounce({ targetAction, delayMs }, context) → Clears any pending timer for the same action key, then schedules context.dispatchAction(targetAction) after delayMs ms.

Waiting for input…
fetchPage

Loads a paginated data page from a server endpoint.

fetchPage({ url, page, pageSize, targetPath }, context) → Fetches url?page=N&pageSize=N and writes response into the data model at targetPath.
Demo requires a running server. See examples/pagination/ for a full live example.
fetchAndAppend

Fetches the next page and appends items to an existing list (infinite scroll).

fetchAndAppend({ url, page, pageSize, targetPath }, context) → Appends fetched items to data model array at targetPath rather than replacing the list.
Demo requires a running server. See examples/pagination/ for a full live example.
subscribeSSE

Opens a Server-Sent Events stream and writes events to the data model.

subscribeSSE({ url, targetPath, eventTypes }, context) → Creates an EventSource connection; writes each received event to targetPath in the data model.
Demo requires a running SSE server. See examples/realtime-streaming/ for a full live example.
subscribeWebSocket

Establishes a WebSocket connection and streams messages to the data model.

subscribeWebSocket({ url, targetPath, protocols }, context) → Creates a WebSocket; on each message, writes parsed JSON (or raw text) to targetPath in the data model.
Demo requires a running WebSocket server. Provide a ws:// URL and a targetPath.