Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify persistent DATA of the widget from JS #41

Open
KarhellTwitch opened this issue Feb 2, 2023 · 1 comment
Open

Modify persistent DATA of the widget from JS #41

KarhellTwitch opened this issue Feb 2, 2023 · 1 comment

Comments

@KarhellTwitch
Copy link

KarhellTwitch commented Feb 2, 2023

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 !

@c4ldas
Copy link

c4ldas commented Feb 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants