How to get access to ALL instances of an Action? #111
Replies: 2 comments
-
In my personal approach, once I needed to update the image of all isntances of an action. What I did, is create a global list. On the other side, time an action is instantiated, it triggers the "willAppear" event and in the same way each time an action instance is destroyed, it triggers the "willDisappear" event. So in your action class, each time willAppear is received, the action instance is added to the global list, and each time the willDisappear is received, the global list deletes that action instance. With that, you access the global list each time you need it and do your stuff. Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
No need to create your own list, because all instances of an action are available in your ActionClass: myAction.actions.forEach(action => console.log(action.id)) or, if you want to span that across all your action-types: [Action1, Action2, Action3].forEach(actionClass => actionClass.actions.forEach(action => console.log(action.id))) But I'd probably prefer to do that the other way round and add an eventListener in the override async onWillAppear(ev: WillAppearEvent<FlipClockActionSettings>): Promise<void> {
AnyConnection.onmessage = (evt: any) => {
....
}
} but likely this is solved already... |
Beta Was this translation helpful? Give feedback.
-
Hi,
my plugin defines a number of Actions. Further it opens a websocket connection and receives data. When data is received it is send to the corresponding Action. So far so good.
The problen is now: when the user creates multiple instances of the same Action, only one instance of the Action is triggered. I expected that all Actions of the same
manifestId
would be triggered and receiving the data. What am I doing wrong?plugin.ts
sscm.ts
The
onmessage
gets data from a websocket. Part ofdata
is acontext
property which represents themanifestId
. Now I'm looking for the matching action and a call a custom functionrefresh
to send the websocet data to the Action.The problem is now: when I have for example 3 positions on my streamdesck assigned with the Action
Drawing
, then only ONE button on the streamdeck is updated with the received data.How can I update all instances/buttons?
Thx for your support!
Beta Was this translation helpful? Give feedback.
All reactions