Skip to content

Commit

Permalink
support sequential actions, version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipivan committed Dec 18, 2024
1 parent 748de3f commit fa0f0fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generic-emberplus",
"version": "2.5.1",
"version": "2.5.2",
"main": "dist/index.js",
"scripts": {
"prepare": "husky",
Expand Down
18 changes: 9 additions & 9 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const setValue =
if (action.options.variable) {
await self.registerNewParameter(path)
}
queue
await queue
.add(async () => {
const node = await emberClient.getElementByPath(path)
// TODO - do we handle not found?
Expand Down Expand Up @@ -193,7 +193,7 @@ const doMatrixAction =
async (action: CompanionActionEvent): Promise<void> => {
const path = await resolvePath(self, action.options['path']?.toString() ?? '')
self.log('debug', 'Get node ' + path)
queue
await queue
.add(async () => {
const node = await emberClient.getElementByPath(path)
// TODO - do we handle not found?
Expand Down Expand Up @@ -222,15 +222,15 @@ const doMatrixAction =
* @param state reference to the state of the module
* @param queue reference to the PQueue of the module
*/
const doMatrixActionFunction = function (
const doMatrixActionFunction = async function (
self: InstanceBase<EmberPlusConfig>,
emberClient: EmberClient,
config: EmberPlusConfig,
state: EmberPlusState,
queue: PQueue,
) {
): Promise<void> {
self.log('debug', 'Get node ' + state.selected.matrix)
queue
await queue
.add(async () => {
if (
state.selected.source !== -1 &&
Expand Down Expand Up @@ -288,7 +288,7 @@ const doTake =
state: EmberPlusState,
queue: PQueue,
) =>
(action: CompanionActionEvent): void => {
async (action: CompanionActionEvent): Promise<void> => {
if (
state.selected.target !== -1 &&
state.selected.source !== -1 &&
Expand All @@ -304,7 +304,7 @@ const doTake =
' on matrix ' +
Number(action.options['matrix']),
)
doMatrixActionFunction(self, emberClient, config, state, queue)
await doMatrixActionFunction(self, emberClient, config, state, queue)
} else {
self.log('debug', 'TAKE went wrong.')
}
Expand Down Expand Up @@ -341,11 +341,11 @@ const setSelectedSource =
state: EmberPlusState,
queue: PQueue,
) =>
(action: CompanionActionEvent): void => {
async (action: CompanionActionEvent): Promise<void> => {
if (action.options['source'] != -1 && Number(action.options['matrix']) == state.selected.matrix) {
state.selected.source = Number(action.options['source'])
self.log('debug', 'Take is: ' + config.take)
if (config.take) doMatrixActionFunction(self, emberClient, config, state, queue)
if (config.take) await doMatrixActionFunction(self, emberClient, config, state, queue)
self.checkFeedbacks(FeedbackId.SourceBackgroundSelected, FeedbackId.Clear, FeedbackId.Take)
self.log('debug', 'setSelectedSource: ' + action.options['source'] + ' on Matrix: ' + state.selected.matrix)
}
Expand Down

0 comments on commit fa0f0fb

Please sign in to comment.