Modify persistent DATA of the widget from JS
Opened this issue · 1 comments
Hello,
I'm actualy writing a widget i want to be customisable from Twitch chat with commands. Everything works fine (command catches, persmissions,...)
But i'm facing a problem.
I didn't find a way to modify widget fields data from JS (DATA tab from JS tab in editor)
Exemple of what i'm trying to do:
- In Twitch chat a command: !!goal max 1500
- Catch the command
- Set the field value stored in DATA to this value
I know JS doesn't support passing parameters by ref, so modify "obj" received will change nothing, am i right ? Each time i'll reload widget, previous data stored in DATA will be back.
Is there a way to bypass my problem ?
Thx !
You cannot change the value of DATA tab with JS.
But if you just want to work with persistent data, you could use SE_API
, which gives access to a database you can store key/value. You have the store.set
and store.get
to work on. The values are accessible from any widget, even if in a different overlay.
You can have a look at it here:
https://github.com/StreamElements/api-docs/blob/main/docs/Widgets.md#se-api