docs: wip wip

This commit is contained in:
bordun 2020-04-06 14:53:08 +02:00
parent 15904133f3
commit f9fd1ca2a8
4 changed files with 15 additions and 11 deletions

View file

@ -95,19 +95,19 @@ Default [client options](../client-options).
----
####  `--disable-vsync`
#### `disable-vsync`
Disable built-in client window's vertical synchronization.
----
####  `--force-gpu`
#### `force-gpu`
Disable built-in client window's gpu blacklist (may improve rendering performance in some cases).
----
####  `--read-only`
#### `read-only`
Disable session editing, and file saving.

View file

@ -65,11 +65,10 @@ This syntax allows writing formulas in pure javascript. The code will be compile
- `console`: javascript console
- `locals`: object for storing/reading arbitrary values. Changing its properties *does not* trigger any synchronisation even if the value is used somewhere else.
- `globals`: same as `locals` but shared between all widgets, contains a few useful variables:
- `screen`: `{width, height}`
- `env`: client options (ie: url query options),
- `url`: server url,
- `platform`: operating system as seen by the client
- `screen`: `{width, height}`
- `env`: client options (ie: url query options),
- `url`: server url,
- `platform`: operating system as seen by the client
In this context, `@{} / OSC{}` are also seen as variables (named `VAR_XXX`), not as the value they hold,

View file

@ -32,7 +32,7 @@
| <h6 id="value" class="dynamic">value<a class="headerlink" href="#value" title="Permanent link">#</a></h6> | `*` | <code>""</code> | Define the widget's value depending on other widget's values / properties using the advanced property syntax |
| <h6 id="default" class="">default<a class="headerlink" href="#default" title="Permanent link">#</a></h6> | `*` | <code>""</code> | If set, the widget will be initialized with this value when the session is loaded. |
| <h6 id="linkId" class="">linkId<a class="headerlink" href="#linkId" title="Permanent link">#</a></h6> | `string`&vert;<br/>`array` | <code>""</code> | Widgets sharing the same `linkId` update each other's value(s) AND send their respective osc messages.<br/><br/>When prefixed with >>, the `linkId` will make the widget act as a master (sending but not receiving)<br/><br/>When prefixed with <<, the `linkId` will make the widget act as a slave (receiving but not sending) |
| <h6 id="script" class="">script<a class="headerlink" href="#script" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed whenever the widget's receives the defined event. See <a href="https://openstagecontrol.ammd.net/v1/docs/widgets/scripting/">documentation</a>. |
| <h6 id="script" class="">script<a class="headerlink" href="#script" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed whenever the widget's value updates. See <a href="https://openstagecontrol.ammd.net/v1/docs/widgets/scripting/">documentation</a>. |
| <h6 class="thead2" id="osc">osc<a class="headerlink" href="#osc" title="Permanent link">#</a></h6> ||||
| <h6 id="address" class="dynamic">address<a class="headerlink" href="#address" title="Permanent link">#</a></h6> | `string` | <code>"auto"</code> | OSC address for sending messages, it must start with a / |
| <h6 id="preArgs" class="dynamic">preArgs<a class="headerlink" href="#preArgs" title="Permanent link">#</a></h6> | `*`&vert;<br/>`array` | <code>""</code> | A value or array of values that will be prepended to the OSC messages. |
@ -655,6 +655,7 @@
| --- | --- | --- | --- |
| <h6 class="thead2" id="script_script">script<a class="headerlink" href="#script_script" title="Permanent link">#</a></h6> ||||
| <h6 id="script_event" class="">event<a class="headerlink" href="#script_event" title="Permanent link">#</a></h6> | `string` | <code>"value"</code> | Define which events trigger the script's execution.<br/><br/>Possible values: value, keyboard |
| <h6 id="script_script" class="">script<a class="headerlink" href="#script_script" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed whenever the widget's receives the defined event. See <a href="https://openstagecontrol.ammd.net/v1/docs/widgets/scripting/">documentation</a>. |
| <h6 class="thead2" id="script_event: keyboard">event: keyboard<a class="headerlink" href="#script_event: keyboard" title="Permanent link">#</a></h6> ||||
| <h6 id="script_keyBinding" class="">keyBinding<a class="headerlink" href="#script_keyBinding" title="Permanent link">#</a></h6> | `string`&vert;<br/>`array` | <code>""</code> | Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation) |
| <h6 id="script_keyRepeat" class="">keyRepeat<a class="headerlink" href="#script_keyRepeat" title="Permanent link">#</a></h6> | `boolean` | <code>true</code> | Set to `false` to prevent keydown repeats when holding the key combo pressed |

View file

@ -1,18 +1,20 @@
# Scripting
The `script` property allows widgets to run javascript code when their value update. It differs from the javascript property syntax in the following ways:
The `script` property allows widgets to run javascript code when their value update. It differs from the [javascript property syntax ](./advanced-syntaxes.md#available-variables) in the following ways:
- no `JS{{}}` wrapper, just the code
- `@{}`, `OSC{}`, `JS{{}}` and `#{}` blocks are replaced with their value before the script's compilation
## Event-dependent variables
Depending on what triggered the script's execution, a few variables are available to help determine the execution conditions.
**Event: value**
- `id` (`string`): id of the widget that's reponsible for the value update
- `value`: widget's value
**Event: keyboard**
**Event: keyboard** (script widget only)
- `type` (`string`): `keydown` or `keyup`
- `key` (`string`): key name,
@ -25,6 +27,8 @@ The `script` property allows widgets to run javascript code when their value upd
## Available variables
Besides the variables available in the [javascript property syntax ](./advanced-syntaxes.md#available-variables), the following variables and functions are also accessible in this context.
----
#### `get`: `function(id)`