roots/platform API
Every export of roots/platform in Roots 0.4.0, read from runtime/platform/web.lisp when this page was built: the declaration, the docstring and the file that defines it. Declarations are TypeScript, printed by the compiler that builds the runtime. A member of a class or of an object has an entry of its own (router.push(), theme.set()). The guides explain how the pieces work together.
Explained in context: Platform adapters.
Functions #
notify #
function notify(title: string, options?: NotifyOptions): Promise<boolean>Show a system notification with the Notification API; asks for permission the first time.
Defined in runtime/platform/web.lisp.
openUrl #
function openUrl(url: string): Promise<void>Open URL in a new browsing context, without giving it a handle to this page.
Defined in runtime/platform/web.lisp.
Constants #
clipboard #
const clipboard: PlatformClipboardclipboard.read() #
read(): Promise<string>clipboard.write() #
write(text: string): Promise<void>Defined in runtime/platform/web.lisp.
info #
const info: PlatformInfoAppInfo plus the platform the app runs on (navigator.platform, Capacitor's platform, process.platform).
info.name #
readonly name: stringinfo.title #
readonly title: stringinfo.version #
readonly version: stringinfo.id #
readonly id: stringinfo.description #
readonly description: stringinfo.target #
readonly target: stringinfo.roots #
readonly roots: stringinfo.platform #
readonly platform: stringDefined in runtime/platform/web.lisp.
screen #
const screen: PlatformScreenThe size of what the app draws on, as refs that follow resizes. COLUMNS and ROWS are terminal cells; on the DOM they are the viewport in cells of 8 × 16 CSS pixels (the unit of the sm/md/lg breakpoints: 80 columns = 640 px). WIDTH and HEIGHT are CSS pixels on the DOM and cells in the terminal. SCROLL-TO scrolls the page to a row (terminal) or pixel (DOM).
screen.columns #
readonly columns: ReadonlyRef<number>screen.rows #
readonly rows: ReadonlyRef<number>screen.width #
readonly width: ReadonlyRef<number>screen.height #
readonly height: ReadonlyRef<number>screen.scrollTo() #
scrollTo(top: number): voidDefined in runtime/platform/web.lisp.
storage #
const storage: PlatformStorageAsynchronous key/value storage for JSON values.
storage.get() #
get(key: string): Promise<unknown>storage.set() #
set(key: string, value: unknown): Promise<void>storage.remove() #
remove(key: string): Promise<void>storage.persist() #
persist(): Promise<boolean>Defined in runtime/platform/web.lisp.
theme #
const theme: PlatformThemeLight or dark, chosen at run time. SET remembers the choice on this device ("system" forgets it and follows the system or the terminal again). CURRENT is the choice, RESOLVED what is shown; both are refs, so templates and effects follow them.
theme.current #
readonly current: ReadonlyRef<ThemeChoice>theme.resolved #
readonly resolved: ReadonlyRef<ThemeName>theme.set() #
set(choice: ThemeChoice): voidDefined in runtime/platform/web.lisp.
updates #
const updates: PlatformUpdatesupdates.onAvailable() #
onAvailable(callback: (a: UpdateHandle) => void): () => voidupdates.onError() #
onError(callback: (a: string) => void): () => voidDefined in runtime/platform/web.lisp.