diff --git a/src/com.elgato.template.sdPlugin/actions/template/property-inspector/inspector.js b/src/com.elgato.template.sdPlugin/actions/template/property-inspector/inspector.js
index ca50f14..809e968 100644
--- a/src/com.elgato.template.sdPlugin/actions/template/property-inspector/inspector.js
+++ b/src/com.elgato.template.sdPlugin/actions/template/property-inspector/inspector.js
@@ -16,8 +16,7 @@ $SD.onConnected((jsn) => {
Utils.debounce(150, () => {
const value = Utils.getFormValue(form);
$SD.sendToPlugin(value, context);
- $SD.setSettings(value);
- console.log(value);
+ $SD.setSettings(value, context);
})
);
});
diff --git a/src/com.elgato.template.sdPlugin/app.js b/src/com.elgato.template.sdPlugin/app.js
index 9a66ff7..90d0c16 100644
--- a/src/com.elgato.template.sdPlugin/app.js
+++ b/src/com.elgato.template.sdPlugin/app.js
@@ -14,9 +14,6 @@ $SD.onConnected(({ actionInfo, appInfo, connection, messageType, port, uuid }) =
.onDeviceDidDisconnect(() => {
console.log({ object: 'stream-deck', event: 'onDeviceDidDisconnect' });
})
- .onSendToPropertyInspector(() => {
- console.log({ object: 'stream-deck', event: 'onSendToPropertyInspector' });
- })
.onApplicationDidLaunch(() => {
console.log({ object: 'stream-deck', event: 'onApplicationDidLaunch' });
})
@@ -57,7 +54,4 @@ new Action('com.elgato.template.action')
})
.onSendToPlugin(() => {
console.log({ object: 'action', event: 'onSendToPlugin' });
- })
- .onSendToPropertyInspector(() => {
- console.log({ object: 'action', event: 'onSendToPropertyInspector' });
});
diff --git a/src/com.elgato.template.sdPlugin/libs/js/action.js b/src/com.elgato.template.sdPlugin/libs/js/action.js
index ad77177..715cf38 100644
--- a/src/com.elgato.template.sdPlugin/libs/js/action.js
+++ b/src/com.elgato.template.sdPlugin/libs/js/action.js
@@ -101,15 +101,6 @@ class ELGSDAction {
this.#on(`${this.UUID}.${Events.sendToPlugin}`, (jsn) => fn(jsn));
return this;
}
-
- /**
- * Registers a callback function for the sendToPropertyInspector event, which fires when the plugin uses the sendToPropertyInspector api
- * @param {function} fn
- */
- onSendToPropertyInspector(fn) {
- this.#on(`${this.UUID}.${Events.sendToPropertyInspector}`, (jsn) => fn(jsn));
- return this;
- }
}
const Action = ELGSDAction;
diff --git a/src/com.elgato.template.sdPlugin/libs/js/constants.js b/src/com.elgato.template.sdPlugin/libs/js/constants.js
index 4623cc9..a25c4a0 100644
--- a/src/com.elgato.template.sdPlugin/libs/js/constants.js
+++ b/src/com.elgato.template.sdPlugin/libs/js/constants.js
@@ -55,17 +55,15 @@ const Events = {
registerPropertyInspector: 'registerPropertyInspector',
registerPlugin: 'registerPlugin',
logMessage: 'logMessage',
- switchToProfile: 'switchToProfile'
-}
+ switchToProfile: 'switchToProfile',
+};
/**
* Constants used for Stream Deck
*/
const Constants = {
dataLocalize: '[data-localize]',
-
- //TODOZ: Try the things that use this in stream-deck.js to see if we really need it?
- hardwareAndSoftware : 0,
- hardwareOnly : 1,
- softwareOnly : 2,
-}
+ hardwareAndSoftware: 0,
+ hardwareOnly: 1,
+ softwareOnly: 2,
+};
diff --git a/src/com.elgato.template.sdPlugin/libs/js/stream-deck.js b/src/com.elgato.template.sdPlugin/libs/js/stream-deck.js
index 48e4bda..ae6390c 100644
--- a/src/com.elgato.template.sdPlugin/libs/js/stream-deck.js
+++ b/src/com.elgato.template.sdPlugin/libs/js/stream-deck.js
@@ -1,9 +1,6 @@
///
///
-// TODO: See if we can add params for the call back function, so that the IDE will provide the jsn object with "context, device, etc"
-// TODO: https://stackoverflow.com/questions/24214962/whats-the-proper-way-to-document-callbacks-with-jsdoc
-
/**
* @class StreamDeck
* StreamDeck object containing all required code to establish
@@ -160,8 +157,9 @@ class ELGSDStreamDeck {
* @param {object} [payload]
*/
send(event, context, payload = {}) {
- const pl = Object.assign({}, {event: event, context: context}, payload);
- this.websocket && this.websocket.send(JSON.stringify(pl)); }
+ const pl = Object.assign({}, { event: event, context: context }, payload);
+ this.websocket && this.websocket.send(JSON.stringify(pl));
+ }
/**
* Request the actions's persistent data. StreamDeck does not return the data, but trigger the actions's didReceiveSettings event
@@ -177,10 +175,10 @@ class ELGSDStreamDeck {
* @param [context]
*/
setSettings(payload, context) {
- this.send(Events.setSettings, context ?? this.uuid, {
+ this.send(Events.setSettings, this.uuid, {
action: this?.actionInfo?.action,
payload: payload || {},
- targetContext: this?.actionInfo?.context,
+ targetContext: context,
});
}
@@ -219,10 +217,10 @@ class ELGSDStreamDeck {
* @param {string} [context]
*/
sendToPlugin(payload, context) {
- this.send(Events.sendToPlugin, context ?? this.uuid, {
+ this.send(Events.sendToPlugin, this.uuid, {
action: this?.actionInfo?.action,
payload: payload || {},
- targetContext: this?.actionInfo?.context,
+ targetContext: context,
});
}
@@ -284,10 +282,10 @@ class ELGSDStreamDeck {
* @param {object} payload
* @param {string} context
*/
- sendToPropertyInspector(payload, context) {
+ sendToPropertyInspector(context, payload) {
this.send(Events.sendToPropertyInspector, context, {
- action: this.actionInfo.action,
- payload: payload,
+ action: this?.actionInfo?.action,
+ payload: payload || {},
});
}
@@ -307,11 +305,11 @@ class ELGSDStreamDeck {
}
/**
- * Switches to a readonly profile or returns to previous profile
+ * Switches to a readonly profile or returns to previous profile
* @param {string} device
* @param {string} [profile]
*/
- switchToProfile(device, profile ) {
+ switchToProfile(device, profile) {
this.send(Events.switchToProfile, this.uuid, { device: device, payload: { profile } });
}
@@ -328,10 +326,11 @@ class ELGSDStreamDeck {
/**
* Registers a callback function for when Stream Deck sends data to the property inspector
* @param {function} fn
+ * @param {function} actionUUID
* @returns ELGSDStreamDeck
*/
- onSendToPropertyInspector(fn) {
- this.#on(Events.sendToPropertyInspector, (jsn) => fn(jsn));
+ onSendToPropertyInspector(fn, actionUUID) {
+ this.#on(`${actionUUID}.${Events.sendToPropertyInspector}`, (jsn) => fn(jsn));
return this;
}