Skip to content

Web pages

Author browser pages in MAST with //web/<path> routes, update them live, and declare them persistent. See the cookbook: Web pages.

API

Procedural helpers for MAST-authored web pages (//web/<path>).

  • web_refresh(path) - force the live //web/<path> session(s) to re-render. Call it after changing the data a page shows (e.g. leaderboard stats) so open browsers update. Pure core: a mission can call it with no dev tooling.

  • web_living(persist=True, refresh=None) - call inside a //web route body to declare the page "living": it should be persisted (a snapshot saved so it's still viewable after the game) and, optionally, re-persisted every refresh seconds. The host-side web proxy reads this registry to drive persistence and to serve the snapshot when the engine is gone.

Both are inert/no-ops when there is no matching web session (safe to call anywhere).

web_living(persist=True, refresh=None)

Declare the current web page living/persistent. Call inside the //web route body; no-op if called outside a web page.

web_living_clear()

Drop all living-page registrations (called on mission reset).

web_living_pages()

Return a copy of the living-page registry: {path: {persist, refresh}}.

web_norm_path(path)

Normalize a web path to the page key used by //web routes: no surrounding slashes and no leading web/ (so "scores", "/web/scores" -> "scores").

web_refresh(path)

Repaint every live //web/<path> session (re-runs the route so it rebuilds with current data). Returns how many sessions were refreshed.