scripting: add screen.orientation and make screen.height/width dynamic
This commit is contained in:
parent
29e18ef23c
commit
bcb74dc0b6
4 changed files with 16 additions and 5 deletions
|
|
@ -91,12 +91,13 @@ A property *cannot* contain multiple `JS{}` blocks
|
|||
- `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`: client screen dimensions (`{width, height}`)
|
||||
- `screen`: client screen informations (`{width, height, orientation}`)
|
||||
- `env`: client options (ie: url query options),
|
||||
- `ip`: client's ip address,
|
||||
- `url`: server url,
|
||||
- `platform`: operating system as seen by the client
|
||||
- `session`: session file path
|
||||
- `clipboard`: instance of navigator [Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard)
|
||||
|
||||
In this context, `@{} / OSC{}` are seen as variables. When they change, the whole block will be evaluated again.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Widgets can run [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaSc
|
|||
|
||||
!!! warning "Advanced syntaxe"
|
||||
Most [advanced syntaxes](../advanced-syntaxes/) should be avoided as much as possible in scripting properties:
|
||||
|
||||
|
||||
- `@{}`: use `get()` and `getProp()` instead
|
||||
- `OSC{}`: use `get()` instead (using another widget as receiver)
|
||||
- `VAR{}`: use `getVar()`instead
|
||||
|
|
@ -104,7 +104,7 @@ The following variables and functions are accessible in this context.
|
|||
- `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`: client screen dimensions (`{width, height}`)
|
||||
- `screen`: client screen informations (`{width, height, orientation}`)
|
||||
- `env`: client options (ie: url query options),
|
||||
- `ip`: client's ip address,
|
||||
- `url`: server url,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue