Skip to the contentSkip to the navigation
RootsGitHubMenu
On this page

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: PlatformClipboard

clipboard.read() #

read(): Promise<string>

clipboard.write() #

write(text: string): Promise<void>

Defined in runtime/platform/web.lisp.

info #

const info: PlatformInfo

AppInfo plus the platform the app runs on (navigator.platform, Capacitor's platform, process.platform).

info.name #

readonly name: string

info.title #

readonly title: string

info.version #

readonly version: string

info.id #

readonly id: string

info.description #

readonly description: string

info.target #

readonly target: string

info.roots #

readonly roots: string

info.platform #

readonly platform: string

Defined in runtime/platform/web.lisp.

screen #

const screen: PlatformScreen

The 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): void

Defined in runtime/platform/web.lisp.

storage #

const storage: PlatformStorage

Asynchronous 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: PlatformTheme

Light 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): void

Defined in runtime/platform/web.lisp.

updates #

const updates: PlatformUpdates

updates.onAvailable() #

onAvailable(callback: (a: UpdateHandle) => void): () => void

updates.onError() #

onError(callback: (a: string) => void): () => void

Defined in runtime/platform/web.lisp.