diff --git a/resources/docs/docs/widgets/advanced-syntaxes.md b/resources/docs/docs/widgets/advanced-syntaxes.md index 75574649..809f438e 100644 --- a/resources/docs/docs/widgets/advanced-syntaxes.md +++ b/resources/docs/docs/widgets/advanced-syntaxes.md @@ -18,7 +18,7 @@ A widget can fetch its own properties or its direct parent's by using the keywor #### `uuid` -Each widget has a unique random identifier that can be retreived with the property name `uuid` (e.g. `@{this.uuid}`, `@{parent.uuid}`). +Each widget has a unique random identifier that can be retreived with the property name `uuid` (e.g. `@{this.uuid}`, `@{parent.uuid}`). #### Dynamic properties @@ -65,7 +65,7 @@ Options can contain `@{}` blocks. ## Javascript: `JS{{ }}` -This syntax allows writing formulas in pure javascript. The code will be compiled as a function and executed in a restricted context. +This syntax allows writing formulas in [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript). The code will be compiled as a function and executed in a restricted context. - if no `return` statement is found, the formula will return an empty string - javascript [strict mode](https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Strict_mode) is always enabled @@ -84,7 +84,7 @@ A property cannot contain multiple `JS{{}}` blocks - `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, +In this context, `@{} / OSC{}` are also seen as variables (named `VAR_XXX`), not as the value they hold. Parsing errors can be read in the DevTool console (F12). diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index 46325da8..086e3cbe 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -1,12 +1,11 @@ # Scripting -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: +The `script` property allows widgets to run [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) code when their value update. -- no `JS{{}}` wrapper, just the code -- `@{}`, `OSC{}`, `JS{{}}` and `#{}` blocks are replaced with their value before the script's compilation +!!! info "It's slightly different from the [javascript property syntax ](./advanced-syntaxes/#javascript-js-code)" -!!! warning "Avoid advanced syntax in scripts" - To avoid syntax errors it is recommended to use `getProp()` and `get()` instead of `@{}` and `OSC{}`. `JS{{}}` and `#{}` blocks should be avoided here as well. + - no `JS{{}}` wrapper, just the code + - `@{}`, `OSC{}`, `JS{{}}` and `#{}` blocks are replaced with their literal value before the script's compilation, therefore **it is recommended to avoid these syntaxes** and use `getProp()` and `get()` instead. ## Event-dependent variables