Skip to Content
sdeck docs

The plugin's context

What a running plugin can do.

Every part of a plugin gets the context: run and components as plugin, the others as their first argument.

MemberWhat it does
pluginId, namespace
dataDirA folder for the plugin's own files. Needs no permission.
log(...)Writes to the app's log
settings()The plugin's settings, secrets included
onSettings(listener)Called after they change. Returns how to stop.
secrets.get(key), secrets.set(key, value)Values kept outside the config. undefined deletes one.
status(text, level)A line under the plugin: "ok", "info" or "error"
state.set(id, value)Publishes a live value
state.get(key), state.watch(keys, listener)Reads live values. Those of other plugins need state.
buttons.list(), buttons.watch(listener)The buttons that have the plugin's actions
overlays.show(id, overlay), overlays.hide(id)Draws over the user's buttons. Needs overlay.
emit(event, payload)Sends <namespace>:<event>, which workflows can start on
vars.get(name), vars.set(name, value)The user's variables. Needs variables.
oauth.start(service, { scopes })Starts a sign-in. Needs network.
oauth.refresh(service, refreshToken)A new access token. Needs network.

In run

FieldWhat it is
settingsThe action's settings, with templates filled in
pluginThe context
sourceWhat started the run
signalAborts when the run is canceled
eventWhat the trigger sent
decknavigate(to, page), brightness() and setBrightness(level)

It may return { result, undo, label }: what later steps get, how to take it back, and what the history calls it.

On this page