host
Services PhoenixCord provides to every plugin.
Functions
Section titled “Functions”log(level: log-level, message: string)
Write to the PhoenixCord log, attributed to this plugin.
get-setting
Section titled “get-setting”get-setting(key: string) → option<setting-value>
The current value of a setting, or its default. none for unknown keys that were never
set.
set-setting
Section titled “set-setting”set-setting(key: string, value: setting-value)
Store a setting and deliver event.setting-changed after the current call returns.
storage-get
Section titled “storage-get”storage-get(key: string) → option<string>
Read from this plugin’s persistent key-value storage.
storage-set
Section titled “storage-set”storage-set(key: string, value: string)
storage-delete
Section titled “storage-delete”storage-delete(key: string)
storage-keys
Section titled “storage-keys”storage-keys() → list<string>
set-timeout
Section titled “set-timeout”set-timeout(delay-ms: u64) → u64
Deliver event.timer with the returned ID once, after delay-ms milliseconds.
set-interval
Section titled “set-interval”set-interval(interval-ms: u64) → u64
Deliver event.timer with the returned ID every interval-ms milliseconds.
clear-timer
Section titled “clear-timer”clear-timer(id: u64)
Cancel a timeout or interval.
fetch(request: http-request) → u64
Send an HTTP request in the background. The result arrives as event.http with the
returned ID.
show-toast
Section titled “show-toast”show-toast(message: string, kind: toast-kind)
show-notice
Section titled “show-notice”show-notice(notice: notice)
notify
Section titled “notify”notify(notification: notification)
open-modal
Section titled “open-modal”open-modal(content: element) → u64
Open a modal showing content. Returns its ID.
update-modal
Section titled “update-modal”update-modal(id: u64, content: element)
close-modal
Section titled “close-modal”close-modal(id: u64)
request-render
Section titled “request-render”request-render()
Ask the client to call this plugin’s render hooks again, e.g. after its state changed.
clipboard-write
Section titled “clipboard-write”clipboard-write(text: string)
clipboard-read
Section titled “clipboard-read”clipboard-read() → option<string>
open-url
Section titled “open-url”open-url(url: string)
Open a URL in the user’s browser.
is-plugin-enabled
Section titled “is-plugin-enabled”is-plugin-enabled(name: string) → bool
Whether a plugin with this name is loaded and running.