cleaned up todos
This commit is contained in:
parent
a1f237c1c8
commit
6b2f59c531
5 changed files with 22 additions and 41 deletions
|
|
@ -16,8 +16,7 @@ $SD.onConnected((jsn) => {
|
||||||
Utils.debounce(150, () => {
|
Utils.debounce(150, () => {
|
||||||
const value = Utils.getFormValue(form);
|
const value = Utils.getFormValue(form);
|
||||||
$SD.sendToPlugin(value, context);
|
$SD.sendToPlugin(value, context);
|
||||||
$SD.setSettings(value);
|
$SD.setSettings(value, context);
|
||||||
console.log(value);
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,6 @@ $SD.onConnected(({ actionInfo, appInfo, connection, messageType, port, uuid }) =
|
||||||
.onDeviceDidDisconnect(() => {
|
.onDeviceDidDisconnect(() => {
|
||||||
console.log({ object: 'stream-deck', event: 'onDeviceDidDisconnect' });
|
console.log({ object: 'stream-deck', event: 'onDeviceDidDisconnect' });
|
||||||
})
|
})
|
||||||
.onSendToPropertyInspector(() => {
|
|
||||||
console.log({ object: 'stream-deck', event: 'onSendToPropertyInspector' });
|
|
||||||
})
|
|
||||||
.onApplicationDidLaunch(() => {
|
.onApplicationDidLaunch(() => {
|
||||||
console.log({ object: 'stream-deck', event: 'onApplicationDidLaunch' });
|
console.log({ object: 'stream-deck', event: 'onApplicationDidLaunch' });
|
||||||
})
|
})
|
||||||
|
|
@ -57,7 +54,4 @@ new Action('com.elgato.template.action')
|
||||||
})
|
})
|
||||||
.onSendToPlugin(() => {
|
.onSendToPlugin(() => {
|
||||||
console.log({ object: 'action', event: 'onSendToPlugin' });
|
console.log({ object: 'action', event: 'onSendToPlugin' });
|
||||||
})
|
|
||||||
.onSendToPropertyInspector(() => {
|
|
||||||
console.log({ object: 'action', event: 'onSendToPropertyInspector' });
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -101,15 +101,6 @@ class ELGSDAction {
|
||||||
this.#on(`${this.UUID}.${Events.sendToPlugin}`, (jsn) => fn(jsn));
|
this.#on(`${this.UUID}.${Events.sendToPlugin}`, (jsn) => fn(jsn));
|
||||||
return this;
|
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;
|
const Action = ELGSDAction;
|
||||||
|
|
|
||||||
|
|
@ -55,17 +55,15 @@ const Events = {
|
||||||
registerPropertyInspector: 'registerPropertyInspector',
|
registerPropertyInspector: 'registerPropertyInspector',
|
||||||
registerPlugin: 'registerPlugin',
|
registerPlugin: 'registerPlugin',
|
||||||
logMessage: 'logMessage',
|
logMessage: 'logMessage',
|
||||||
switchToProfile: 'switchToProfile'
|
switchToProfile: 'switchToProfile',
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants used for Stream Deck
|
* Constants used for Stream Deck
|
||||||
*/
|
*/
|
||||||
const Constants = {
|
const Constants = {
|
||||||
dataLocalize: '[data-localize]',
|
dataLocalize: '[data-localize]',
|
||||||
|
|
||||||
//TODOZ: Try the things that use this in stream-deck.js to see if we really need it?
|
|
||||||
hardwareAndSoftware: 0,
|
hardwareAndSoftware: 0,
|
||||||
hardwareOnly: 1,
|
hardwareOnly: 1,
|
||||||
softwareOnly: 2,
|
softwareOnly: 2,
|
||||||
}
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
/// <reference path="event-emitter.js" />
|
/// <reference path="event-emitter.js" />
|
||||||
/// <reference path="constants.js" />
|
/// <reference path="constants.js" />
|
||||||
|
|
||||||
// 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
|
* @class StreamDeck
|
||||||
* StreamDeck object containing all required code to establish
|
* StreamDeck object containing all required code to establish
|
||||||
|
|
@ -161,7 +158,8 @@ class ELGSDStreamDeck {
|
||||||
*/
|
*/
|
||||||
send(event, context, payload = {}) {
|
send(event, context, payload = {}) {
|
||||||
const pl = Object.assign({}, { event: event, context: context }, payload);
|
const pl = Object.assign({}, { event: event, context: context }, payload);
|
||||||
this.websocket && this.websocket.send(JSON.stringify(pl)); }
|
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
|
* 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]
|
* @param [context]
|
||||||
*/
|
*/
|
||||||
setSettings(payload, context) {
|
setSettings(payload, context) {
|
||||||
this.send(Events.setSettings, context ?? this.uuid, {
|
this.send(Events.setSettings, this.uuid, {
|
||||||
action: this?.actionInfo?.action,
|
action: this?.actionInfo?.action,
|
||||||
payload: payload || {},
|
payload: payload || {},
|
||||||
targetContext: this?.actionInfo?.context,
|
targetContext: context,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -219,10 +217,10 @@ class ELGSDStreamDeck {
|
||||||
* @param {string} [context]
|
* @param {string} [context]
|
||||||
*/
|
*/
|
||||||
sendToPlugin(payload, context) {
|
sendToPlugin(payload, context) {
|
||||||
this.send(Events.sendToPlugin, context ?? this.uuid, {
|
this.send(Events.sendToPlugin, this.uuid, {
|
||||||
action: this?.actionInfo?.action,
|
action: this?.actionInfo?.action,
|
||||||
payload: payload || {},
|
payload: payload || {},
|
||||||
targetContext: this?.actionInfo?.context,
|
targetContext: context,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -284,10 +282,10 @@ class ELGSDStreamDeck {
|
||||||
* @param {object} payload
|
* @param {object} payload
|
||||||
* @param {string} context
|
* @param {string} context
|
||||||
*/
|
*/
|
||||||
sendToPropertyInspector(payload, context) {
|
sendToPropertyInspector(context, payload) {
|
||||||
this.send(Events.sendToPropertyInspector, context, {
|
this.send(Events.sendToPropertyInspector, context, {
|
||||||
action: this.actionInfo.action,
|
action: this?.actionInfo?.action,
|
||||||
payload: payload,
|
payload: payload || {},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -328,10 +326,11 @@ class ELGSDStreamDeck {
|
||||||
/**
|
/**
|
||||||
* Registers a callback function for when Stream Deck sends data to the property inspector
|
* Registers a callback function for when Stream Deck sends data to the property inspector
|
||||||
* @param {function} fn
|
* @param {function} fn
|
||||||
|
* @param {function} actionUUID
|
||||||
* @returns ELGSDStreamDeck
|
* @returns ELGSDStreamDeck
|
||||||
*/
|
*/
|
||||||
onSendToPropertyInspector(fn) {
|
onSendToPropertyInspector(fn, actionUUID) {
|
||||||
this.#on(Events.sendToPropertyInspector, (jsn) => fn(jsn));
|
this.#on(`${actionUUID}.${Events.sendToPropertyInspector}`, (jsn) => fn(jsn));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue