@@ -32,7 +32,7 @@ export enum CardsActionId {
3232}
3333
3434export function createCardsActions ( self : InstanceBaseExt < WingConfig > ) : CompanionActionDefinitions {
35- const send = self . sendCommand
35+ const send = self . connection ! . sendCommand . bind ( self . connection )
3636
3737 const actions : { [ id in CardsActionId ] : CompanionActionWithCallback | undefined } = {
3838 [ CardsActionId . SetLink ] : {
@@ -41,8 +41,8 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
4141 options : [ ...GetDropdownWithVariables ( 'Link' , 'link' , getCardsLinkChoices ( ) ) ] ,
4242 callback : async ( event ) => {
4343 const cmd = Commands . WLiveSDLink ( )
44- const link = await getStringWithVariables ( event , 'link' )
45- send ( cmd , link )
44+ const link = getStringWithVariables ( event , 'link' )
45+ await send ( cmd , link )
4646 } ,
4747 } ,
4848 [ CardsActionId . SetAutoInput ] : {
@@ -51,8 +51,8 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
5151 options : [ ...GetDropdownWithVariables ( 'Selection' , 'selection' , getCardsAutoInChoices ( ) ) ] ,
5252 callback : async ( event ) => {
5353 const cmd = Commands . WLiveAutoIn ( )
54- const selection = await getStringWithVariables ( event , 'selection' )
55- send ( cmd , selection )
54+ const selection = getStringWithVariables ( event , 'selection' )
55+ await send ( cmd , selection )
5656 } ,
5757 } ,
5858 [ CardsActionId . SetAutoStop ] : {
@@ -61,8 +61,8 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
6161 options : [ ...GetDropdownWithVariables ( 'Selection' , 'selection' , getCardsAutoRoutingChoices ( ) ) ] ,
6262 callback : async ( event ) => {
6363 const cmd = Commands . WLiveAutoStop ( )
64- const selection = await getStringWithVariables ( event , 'selection' )
65- send ( cmd , selection )
64+ const selection = getStringWithVariables ( event , 'selection' )
65+ await send ( cmd , selection )
6666 } ,
6767 } ,
6868 [ CardsActionId . SetAutoPlay ] : {
@@ -71,8 +71,8 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
7171 options : [ ...GetDropdownWithVariables ( 'Selection' , 'selection' , getCardsAutoRoutingChoices ( ) ) ] ,
7272 callback : async ( event ) => {
7373 const cmd = Commands . WLiveAutoPlay ( )
74- const selection = await getStringWithVariables ( event , 'selection' )
75- send ( cmd , selection )
74+ const selection = getStringWithVariables ( event , 'selection' )
75+ await send ( cmd , selection )
7676 } ,
7777 } ,
7878 [ CardsActionId . SetAutoRecord ] : {
@@ -81,8 +81,8 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
8181 options : [ ...GetDropdownWithVariables ( 'Selection' , 'selection' , getCardsAutoRoutingChoices ( ) ) ] ,
8282 callback : async ( event ) => {
8383 const cmd = Commands . WLiveAutoRecord ( )
84- const selection = await getStringWithVariables ( event , 'selection' )
85- send ( cmd , selection )
84+ const selection = getStringWithVariables ( event , 'selection' )
85+ await send ( cmd , selection )
8686 } ,
8787 } ,
8888 [ CardsActionId . CardAction ] : {
@@ -93,10 +93,10 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
9393 ...GetDropdownWithVariables ( 'Action' , 'action' , getCardsActionChoices ( ) ) ,
9494 ] ,
9595 callback : async ( event ) => {
96- const card = await getNumberWithVariables ( event , 'card' )
96+ const card = getNumberWithVariables ( event , 'card' )
9797 const cmd = Commands . WLiveCardControl ( card )
98- const action = await getStringWithVariables ( event , 'action' )
99- send ( cmd , action )
98+ const action = getStringWithVariables ( event , 'action' )
99+ await send ( cmd , action )
100100 } ,
101101 } ,
102102 [ CardsActionId . OpenSession ] : {
@@ -107,10 +107,10 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
107107 ...GetNumberFieldWithVariables ( 'Session Number' , 'session' , 1 , 100 , 1 , 1 ) ,
108108 ] ,
109109 callback : async ( event ) => {
110- const card = await getNumberWithVariables ( event , 'card' )
111- const session = await getNumberWithVariables ( event , 'session' )
110+ const card = getNumberWithVariables ( event , 'card' )
111+ const session = getNumberWithVariables ( event , 'session' )
112112 const cmd = Commands . WLiveCardOpenSession ( card )
113- send ( cmd , session )
113+ await send ( cmd , session )
114114 } ,
115115 } ,
116116 [ CardsActionId . DeleteSession ] : {
@@ -121,10 +121,10 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
121121 ...GetNumberFieldWithVariables ( 'Session Number' , 'session' , 1 , 100 , 1 , 1 ) ,
122122 ] ,
123123 callback : async ( event ) => {
124- const card = await getNumberWithVariables ( event , 'card' )
125- const session = await getNumberWithVariables ( event , 'session' )
124+ const card = getNumberWithVariables ( event , 'card' )
125+ const session = getNumberWithVariables ( event , 'session' )
126126 const cmd = Commands . WLiveCardDeleteSession ( card )
127- send ( cmd , session )
127+ await send ( cmd , session )
128128 } ,
129129 } ,
130130 [ CardsActionId . NameSession ] : {
@@ -140,10 +140,10 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
140140 ) ,
141141 ] ,
142142 callback : async ( event ) => {
143- const card = await getNumberWithVariables ( event , 'card' )
144- const name = await getStringWithVariables ( event , 'name' )
143+ const card = getNumberWithVariables ( event , 'card' )
144+ const name = getStringWithVariables ( event , 'name' )
145145 const cmd = Commands . WLiveCardNameSession ( card )
146- send ( cmd , name )
146+ await send ( cmd , name )
147147 } ,
148148 } ,
149149 [ CardsActionId . SetPosition ] : {
@@ -154,22 +154,22 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
154154 ...GetNumberFieldWithVariables ( 'Position (ms)' , 'position' , 0 , 36000000 , 1 , 0 ) ,
155155 ] ,
156156 callback : async ( event ) => {
157- const card = await getNumberWithVariables ( event , 'card' )
158- const position = await getNumberWithVariables ( event , 'position' )
157+ const card = getNumberWithVariables ( event , 'card' )
158+ const position = getNumberWithVariables ( event , 'position' )
159159 const cmd = Commands . WLiveCardTime ( card )
160- send ( cmd , position , true )
160+ await send ( cmd , position , true )
161161 const cmd2 = Commands . WLiveCardGotoMarker ( card )
162- send ( cmd2 , 101 )
162+ await send ( cmd2 , 101 )
163163 } ,
164164 } ,
165165 [ CardsActionId . AddMarker ] : {
166166 name : 'WLive: Add Marker' ,
167167 description : 'Add a marker to a recording on a card.' ,
168168 options : [ ...GetDropdownWithVariables ( 'Card' , 'card' , getCardsChoices ( ) ) ] ,
169169 callback : async ( event ) => {
170- const card = await getNumberWithVariables ( event , 'card' )
170+ const card = getNumberWithVariables ( event , 'card' )
171171 const cmd = Commands . WLiveCardSetMarker ( card )
172- send ( cmd , 1 )
172+ await send ( cmd , 1 )
173173 } ,
174174 } ,
175175 [ CardsActionId . EditMarker ] : {
@@ -181,10 +181,10 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
181181 ] ,
182182
183183 callback : async ( event ) => {
184- const card = await getNumberWithVariables ( event , 'card' )
185- const marker = await getNumberWithVariables ( event , 'marker' )
184+ const card = getNumberWithVariables ( event , 'card' )
185+ const marker = getNumberWithVariables ( event , 'marker' )
186186 const cmd = Commands . WLiveCardEditMarker ( card )
187- send ( cmd , marker )
187+ await send ( cmd , marker )
188188 } ,
189189 } ,
190190 [ CardsActionId . GotoMarker ] : {
@@ -196,10 +196,10 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
196196 ] ,
197197
198198 callback : async ( event ) => {
199- const card = await getNumberWithVariables ( event , 'card' )
200- const marker = await getNumberWithVariables ( event , 'marker' )
199+ const card = getNumberWithVariables ( event , 'card' )
200+ const marker = getNumberWithVariables ( event , 'marker' )
201201 const cmd = Commands . WLiveCardGotoMarker ( card )
202- send ( cmd , marker )
202+ await send ( cmd , marker )
203203 } ,
204204 } ,
205205 [ CardsActionId . DeleteMarker ] : {
@@ -211,20 +211,20 @@ export function createCardsActions(self: InstanceBaseExt<WingConfig>): Companion
211211 ] ,
212212
213213 callback : async ( event ) => {
214- const card = await getNumberWithVariables ( event , 'card' )
215- const marker = await getNumberWithVariables ( event , 'marker' )
214+ const card = getNumberWithVariables ( event , 'card' )
215+ const marker = getNumberWithVariables ( event , 'marker' )
216216 const cmd = Commands . WLiveCardDeleteMarker ( card )
217- send ( cmd , marker )
217+ await send ( cmd , marker )
218218 } ,
219219 } ,
220220 [ CardsActionId . FormatCard ] : {
221221 name : 'WLive: Format Card' ,
222222 description : 'Format (delete all contents) of a card.' ,
223223 options : [ ...GetDropdownWithVariables ( 'Card' , 'card' , getCardsChoices ( ) ) ] ,
224224 callback : async ( event ) => {
225- const card = await getNumberWithVariables ( event , 'card' )
225+ const card = getNumberWithVariables ( event , 'card' )
226226 const cmd = Commands . WLiveCardFormat ( card )
227- send ( cmd , 1 )
227+ await send ( cmd , 1 )
228228 } ,
229229 } ,
230230 }
0 commit comments