diff --git a/package.json b/package.json index 8ba1219..2ca7865 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generic-emberplus", - "version": "2.5.1", + "version": "2.5.2", "main": "dist/index.js", "scripts": { "prepare": "husky", diff --git a/src/actions.ts b/src/actions.ts index 40e4e7c..7af0c53 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -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? @@ -193,7 +193,7 @@ const doMatrixAction = async (action: CompanionActionEvent): Promise => { 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? @@ -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, emberClient: EmberClient, config: EmberPlusConfig, state: EmberPlusState, queue: PQueue, -) { +): Promise { self.log('debug', 'Get node ' + state.selected.matrix) - queue + await queue .add(async () => { if ( state.selected.source !== -1 && @@ -288,7 +288,7 @@ const doTake = state: EmberPlusState, queue: PQueue, ) => - (action: CompanionActionEvent): void => { + async (action: CompanionActionEvent): Promise => { if ( state.selected.target !== -1 && state.selected.source !== -1 && @@ -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.') } @@ -341,11 +341,11 @@ const setSelectedSource = state: EmberPlusState, queue: PQueue, ) => - (action: CompanionActionEvent): void => { + async (action: CompanionActionEvent): Promise => { 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) }