Space Plugin SDKSpace Plugin SDK
Home
Overview
  • 中文简体
  • English
Home
Overview
  • 中文简体
  • English
  • SDK

    • Overview
    • Getting Started
    • Terminology
    • Architecture
    • Manifest
    • Internationalization
    • Received Events
    • Events Sent
    • Registration Procedure
    • Property Inspector
    • Style Guide
    • Changelog
  • Example

    • Counter
    • Timer
    • Number Display
    • Time
  • Support

    • Help and Error Reporting

Events Sent

Plugins can send events to the Stream Dock application.

Both plugins and Property Inspectors can send the following events:

EventDescription
setSettingsPermanently save data for an action instance
getSettingsRequest persistent data for an action instance
setGlobalSettingsGlobally save plugin data
getGlobalSettingsRequest global persistent data
openUrlOpen a URL in the default browser
logMessageWrite a debug message to the log file

Additional events that plugins can send:

EventDescription
setTitleDynamically change the title of an action instance
setImageDynamically change the image of an action instance
showAlertTemporarily show an alert icon on the action instance's image
showOkTemporarily show an "OK" checkmark icon on the action instance's image
setStateChange the state of an action instance that supports multiple states
sendToPropertyInspectorSend data to the Property Inspector

Additional events that Property Inspectors can send:

EventDescription
sendToPluginSend data to the plugin

setSettings

Plugins and Property Inspectors can use this event to permanently save data for an action instance

{
    "event": "setSettings",
    "context": uniqueValue,
    "payload": {<json data>}
}
MemberDescription
eventsetSettings
contextIf it is a plugin call, the value is the context of the plugin action, if the property inspector calls this, the value is the property inspector's inPropertyInspectorUUID
payloadData sent by the plugin or Property Inspector

TIP

Note that when a plugin uses this API, the Property Inspector will automatically receive a didReceiveSettings callback with the new settings. Similarly, when the Property Inspector uses this API, the plugin will automatically receive a didReceiveSettings callback with the new settings.

getSettings

Plugins and Property Inspectors can use this event to request persistent data stored for an action instance

{
    "event": "getSettings",
    "context": uniqueValue
}
MemberDescription
eventgetSettings
contextIf the plugin calls this, the value is the plugin's inPluginUUID, if the property inspector calls this, the value is the property inspector's inPropertyInspectorUUID

The plugin or Property Inspector will asynchronously receive a didReceiveSettings event containing the settings for this action.

{
  "action": "com.mirabox.demo.action1", 
  "event": "didReceiveSettings", 
  "context": uniqueValue, 
  "device": uniqueValue, 
  "payload": {
   "settings": {<json data>},
    "coordinates": {
      "column": 3, 
      "row": 1
    }, 
    "isInMultiAction": false
  }
}

setGlobalSettings

Plugins and Property Inspectors can globally save persistent data. This API can be used to save tokens or other data that should be available across all actions in the plugin.

{
    "event": "setGlobalSettings",
    "context": uniqueValue,
    "payload": {<json data>}
}
MemberDescription
eventsetGlobalSettings
contextIf the plugin calls this, the value is the plugin's inPluginUUID, if the property inspector calls this, the value is the property inspector's inPropertyInspectorUUID
payloadData to be saved

TIP

Please note that when the plugin uses this API, the Property Inspector will automatically receive a didReceiveGlobalSettings callback with the new settings. Similarly, when the Property Inspector uses this API, the plugin will automatically receive a didReceiveGlobalSettings callback with the new settings

getGlobalSettings

Plugins and Property Inspectors can use this event to request globally stored persistent data.

{
    "event": "getGlobalSettings",
    "context": uniqueValue
}
MemberDescription
eventgetGlobalSettings
contextIf the plugin calls this, the value is the plugin's inPluginUUID, if the property inspector calls this, the value is the property inspector's inPropertyInspectorUUID

Plugins or Property Inspectors will asynchronously receive the event didReceiveGlobalSettings containing the global settings.

{
  "event": "didReceiveGlobalSettings", 
  "payload": {
     "settings": {<json data>}
   }
}

openUrl

Plugins or Property Inspectors can use this event to open a URL in the default browser.

{
    "event": "openUrl",
    "payload": {
        "url": "https://www.example.com"
    }
}
MemberDescription
eventopenUrl
payloadJSON object

The payload object contains the following member:

payloadDescription
urlThe URL to open

logMessage

The plug-in or property inspector can use this event to print the debug log to the debug window. Double-click the software version number in the settings to open the debug window (it is only used for temporary debugging and will not be recorded in the log file. If you need to permanently record the information, you need to write it locally by yourself, such as generating a log.txt in the plug-in to record the information)

{
 "event": "logMessage",
 "payload": {
  "message": "Hello World!"
 }
}
MemberDescription
eventlogMessage
payloadJSON object

The payload object contains the following member:

payloadDescription
messageThe message to write to the log file

setTitle

Plugins can use this event to dynamically change the title of an action instance.

{
    "event": "setTitle",
    "context": uniqueValue,
    "payload": {
        "title": "MyTitle",
        "target": software, hardware or both,
        "state": 0-based integer
    }
}
MemberDescription
eventsetTitle
contextIdentifier for the action instance
payloadJSON object

The payload object contains the following members:

payloadDescription
titleThe title to set
targetSpecifies whether the title should be displayed on hardware and software (0), only on hardware (1), only on software (2), default is 0
stateAn integer value starting from 0, representing the state of an action with multiple states. If not specified, the title will be set for all states

setImage

Plugins can use this event to dynamically change the image of an action instance.

{
    "event": "setImage",
    "context": uniqueValue,
    "payload": {
        "image": <base64 encoded image>,
        "target": software, hardware or both,
        "state": 0-based integer
    }
}
MemberDescription
eventsetImage
contextIdentifier for the action instance
payloadJSON object

The payload object contains the following members:

payloadDescription
imageThe base64-encoded image to set
targetSpecifies whether the image should be displayed on hardware and software (0), only on hardware (1), only on software (2), default is 0
stateAn integer value starting from 0, representing the state of an action with multiple states. If not specified, the image will be set for all states

Base64-encoded image examples:

"data:image/png;base64,avFOdwp0Ksgoe..."
"data:image/jpg;base64,avFOdwp0Ksgoe..."
"data:image/gif;base64,avFOdwp0Ksgoe..."

This API also accepts SVG images. Below is an example with an SVG image:

{
    "event": "setImage",
    "context": context,
    "payload": {
        "image": "data:image/svg+xml;charset=utf8,<svg></svg>",
        "target": 0
    }
}

showAlert

Plugins can use this event to display a temporary alert icon on the action.

{
    "event": "showAlert",
    "context": uniqueValue
}
MemberDescription
eventshowAlert
contextIdentifier for the action instance

showOk

Plugins can use this event to display a temporary OK checkmark icon on the action.

{
    "event": "showOk",
    "context": uniqueValue
}
MemberDescription
eventshowOk
contextIdentifier for the action instance

setState

Plugins can use this event to dynamically change the state of the action instance.

{
    "event": "setState",
    "context": uniqueValue,
    "payload": {
        state
    }
}
MemberDescription
eventsetState
contextIdentifier for the action instance
payloadJSON object

The payload object contains the following member:

payloadDescription
stateAn integer value starting from 0, representing the state of the action with multiple states

sendToPropertyInspector

Plugins can use this event to send data to the Property Inspector.

{
    "action": "com.mirabox.demo.action1",
    "event": "sendToPropertyInspector",
    "context": uniqueValue,
    "payload": {<json data>}
}
MemberDescription
actionUnique identifier for the action
eventsendToPropertyInspector
contextIdentifier for the action instance
payloadJSON object

The Property Inspector will asynchronously receive the sendToPropertyInspector event.

{
  "action": "com.mirabox.demo.action1", 
  "event": "sendToPropertyInspector", 
  "context": uniqueValue, 
  "payload": {<json data>}
}

sendToPlugin

The Property Inspector can use this event to send data to the plugin.

{
    "action": "com.mirabox.demo.action1",
    "event": "sendToPlugin",
    "context": uniqueValue,
    "payload": {<json data>}
}
MemberDescription
actionUnique identifier for the action
eventsendToPlugin
contextThe value is the property inspector's inPropertyInspectorUUID
payloadJSON object

The plugin will asynchronously receive the sendToPlugin event.

{
  "action": "com.mirabox.demo.action1", 
  "event": "sendToPlugin", 
  "context": uniqueValue, 
  "payload": {<json data>}
}
Last Updated:
Contributors: Heart
Prev
Received Events
Next
Registration Procedure