scripting: stateSet: add optional {send: false} flag

This commit is contained in:
jean-emmanuel 2023-11-22 10:15:40 +01:00
parent 2c97ac662c
commit a6237a0aac
3 changed files with 11 additions and 3 deletions

View file

@ -1,5 +1,10 @@
# Changelog
## 1.26.0
- scripting
- `stateSet`: add optional `{send: false}` flag
## 1.25.5
- bug fixes

View file

@ -233,10 +233,13 @@ Returns a state object (`id:value`) for matching widget and all their children.
----
#### `stateSet(state)`
#### `stateSet(state, options)`
Loads a state object. If the event that triggered the script's execution was initiated by a user interaction, this will make the updated widgets send their value as well.
- `options` (optional): `object`, accepts the following items:
- `send: false`: prevents widgets from sending osc messages
----
#### `storage`

View file

@ -330,12 +330,12 @@ class ScriptVm extends Vm {
}
this.sandbox.contentWindow.stateSet = (state)=>{
this.sandbox.contentWindow.stateSet = (state, extraOptions = {})=>{
this.checkContext('stateSet')
var options = this.getValueOptions()
stateManager.set(state, options.send)
stateManager.set(state, extraOptions.send === false ? false : options.send)
}