Actions
What an action, @click or on-* can run: the statement forms and every prefix command, such as navigate:, haptic: and share:.
Generated from the engine's spec (HAM 1.7.0), so it always matches what the engine reads.
Statement forms
| Name | What it does |
|---|---|
$name += n |
Add n ($name -= n subtracts); the same as $name = $name + (n). On a loop row's field ($row.votes += 5) it writes the row; on a counter it adds. |
$name = expression |
Set a variable (or \$id.prop). The right side is a literal, a $reference, or arithmetic; quote strings that contain - + * / % ( ). |
<statement>; <statement> |
Run in order. |
#id.command[:arg] |
A command to an element by its id (each tag lists the commands it takes: #player.play, #menu.open) or to a virtual id (#fx, #db). |
#db.<model>.<verb>[:args] | #db.<verb> |
A database verb on a model (#db.todo.create:title=Milk, update, delete, toggle, increment …) or on the whole database (#db.backup, #db.sync, #db.sync.erase, #db.wipe). |
$name-- |
Subtract 1. |
file:/path | folder:/path | /path | path | https://… |
Fetch HAM and swap it into the target (or push it, on <navigate>). One action fetches once: a later URL, or one after app: / go:home / back / root / reload / reload-current / auth: / ad:, is not sent (a bare home is a page path: it is the fetch) (a debug warning says so). forget-app: leaves the slot free. |
if <condition> then <statement> [else <statement>] |
Conditional; the condition is the @show grammar, each branch one statement or several in parentheses (then ($a++; #yay.burst) else …), else if chains nest. |
$name++ |
Add 1. |
<verb>:<args> | <word> |
An action statement, a verb and its arguments or a single word: navigate:, app:, haptic:, notify:, reload … |
<condition> ? <statement> : <statement> |
Conditional, short form; the ? and : are spaced so URLs are never mistaken for one; a branch may be a group in parentheses. |
Commands
| Name | What it does |
|---|---|
ad:interstitial | rewarded | rewarded-interstitial | load:{format} | consent[:reset | :status] | inspector |
Full-screen ads and consent. Statements after ad:rewarded run only if the reward was earned. |
app:{url} | {ms}:{url} |
Switch the whole <app> document (multi-app shells), optionally after a delay. |
auth:login | logout | pair:{code} |
login/logout: run the configured auth flow and swap the returned HAM into the target. pair:{code} (interpolates $vars): exchange a typed pairing code at auth_token_path for a bearer, then re-fetch the page on screen; on failure the screen stays and $auth.error says why ($auth.error_code: the code the server gave, e.g. already_linked). |
back |
Pop this page (the same as navigate:back and go:back); at the first page (a tab root, nothing pushed) it does nothing. Chains after other statements: "$picked = 1; back". |
clipboard:copy:{text} | paste:$var |
Write to or read from the system clipboard. |
feedback:[{to}][:{subject}] |
Open the mail composer to send written feedback. |
forget-app:url | url#scope=key |
Shelf only (the document with <config home_url>): erase that app's scope — database, cookies, bearer token, offline copies. Not the shelf or the app on screen. |
go:home | back | root |
The engine's own moves. go:home: back to the shelf page the app was opened from (and the portal open over it), else the shelf's <config home_url>, else the launch document. go:back: pop this page (as navigate:back). go:root: return to the first page (as navigate:root). Chainable after other statements: "$picked = 1; go:back". A bare back / root is the same move; a bare home is a page path (action="home" fetches the page home). |
haptic:light | medium | heavy | selection |
Haptic feedback. On a watch, four distinct vibrations from what the watch supports (selection the faintest, heavy the strongest). |
key:up | down | left | right | ok | back | play | pause | playpause | stop | rewind | fastforward | next | previous | menu | info | channelup | channeldown |
Press a TV remote button: the arrows move focus, ok taps the focused element, back goes back, the media buttons go to @on.key.NAME. A stream event named key presses one the same way. |
mailto:{address}[?subject=…&body=…] |
Write an email in the mail app (as open:mailto:…). On a TV it does nothing (a warning). |
navigate:{url} |
Push a new screen from any element. navigate:back pops this page (nothing at the first page) and navigate:root returns to the first one; both chain after other statements ("$picked = 1; navigate:back"). navigate:/ fetches the document at / (it does not pop). |
notify:{title}:{body}[:delay:{s} | :at:{ISO}][:badge:{n}] | permission:request | permission:open-settings | cancel:all | cancel:{tag} | badge:{n} | badge:clear |
Local notifications. A delayed or timed one uses an exact Android alarm when the OS allows it, else an inexact one (within about a minute). badge:{n} puts a count on the app icon (clear or 0 removes it, the tray is left alone); a trailing :badge:{n} makes a notification carry one. |
open:{url} |
Open externally: https://, tel:, mailto:, sms:, custom schemes. On a TV, never another app: a web address shows an "Open on your phone" panel (address and QR code); other schemes do nothing. |
rate:request | store |
Alias of review:. |
reload |
Re-fetch the root document and re-apply <config> live (no fade, no pop), then re-fetch a page pushed over it, if any. |
reload-current |
Re-fetch what is on screen now (the top pushed page, else the root document) and rebuild it in place, keeping the navigation stack. |
review:request | store |
Rate this app: the native in-app rating sheet (request) or the store listing (store). |
root |
Return to the first page, popping every pushed one (the same as navigate:root and go:root). |
share:{text} | {text}:{subject} |
System share sheet. |
sms:{number}[?body=…] |
Write a text message in the messages app (as open:sms:…). On a TV it does nothing (a warning). |
speak:{text}[:{lang}[:{rate}]] | stop |
Text-to-speech. lang is a BCP-47 tag (fr-FR); rate a multiplier (1 normal, 0.5 slow, 2 fast). Omitted, each is the device language / normal speed, per call. $speaking tracks playback. |
tel:{number} |
Call: the dialler with the number (as open:tel:… or <a href="tel:…">). On a TV it does nothing (a warning). |