Reference · General

platform

signature
platform() -> map

What it does

Where the program runs, as a map. The runtime reads it from the system once, and in a phone app the app's launcher adds what only it knows. A component cannot call it: it runs on the server, as env does, so a page asks through a server fn.

FieldSays
os"ios", "android", "macos", "linux", "windows", "freebsd"
os_name, os_versionthe system's own name and version: "iOS" and "27.0", "Android" and "15", "macOS" and "15.5", "Ubuntu" and "24.04"
kernelthe kernel's release
device"phone" ("tablet" on an iPad or a large Android device), "desktop" (in quillo app) or "server"
modelthe hardware model: "iPhone19,2", "Pixel 9", "Mac15,6"; null when the system does not say
arch, cpusthe processor ("aarch64", "x86_64") and how many cores the program may use
simulatortrue in the iOS simulator and an Android emulator
runtimehow the program runs: "mobile" in a phone app, "app" in quillo app, "server"
locale, time_zone"en-SG", "Asia/Singapore"; null when unknown
screenin a phone app, { width, height, scale } in points; null elsewhere
appin a phone app, { name, id, version, build }; null elsewhere
quilloQuillo's version, as quillo --version says it

A phone app's launcher may add fields of its own: memory and model_family (the maker on Android), and sdk (the API level) on Android.

Examples

let p = platform()print(p.runtime, p.device, p.simulator)print(type_of(p.cpus), p.cpus > 0, type_of(p.os_version))print(p.screen, p.app)
output
server server falseint true strnull null

In a page, through a server fn:

in a program
server fn device() = platform()component About() {    state p = device()    <p>{p.os_name} {p.os_version} on {p.model ?? p.arch}{p.simulator ? " (simulator)" : ""}</p>}

Edge cases

See also

env, and the Phone apps guide.

Thread
12Useful? Like it, or add to its thread below.

Thread 0 posts

On platform(): questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.

    Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo