Runtime API
These APIs are available on pluginApi inside setup and inside activity render functions.
pluginApi.config
Read and react to config values at runtime.
config.get
Returns the current value of any config option, including custom ones registered by your plugin.
config.subscribe
Calls a callback immediately with the current value and again whenever that config value changes. Returns an unsubscribe function. Subscriptions created during setup are cleaned up automatically when the plugin is unregistered. Subscriptions created inside an activity’s render function should be unsubscribed in that activity’s cleanup function.
Inside an activity’s render function, tie the subscription to that mount and unsubscribe in the returned cleanup function:
pluginApi.activity
Access the parameters passed to the currently active activity via setCurrentActivity.
activity.getParams
Returns the current activity parameters synchronously. Useful for reading params once at setup time or at the start of an activity render.
activity.subscribeToParams
Subscribes to parameter changes. The callback fires immediately with the current params, then on every subsequent update. Returns an unsubscribe function.
The render function receives params as its second argument for the initial mount, but if your activity can be re-activated with new params while already mounted, use subscribeToParams inside render to react to those updates:
pluginApi.files
Mutate file entries in the upload collection.
files.update
Updates mutable properties of a file entry by its internalId.