scripting: expose instance of navigator as globals.clipboard

This commit is contained in:
jean-emmanuel 2021-04-23 10:28:25 +02:00
parent f3acec538f
commit 6cc1a26127
3 changed files with 18 additions and 2 deletions

View file

@ -11,6 +11,9 @@
- widgets
- menu/switch/dropdown: reset value to `undefined` when receiving a value that's not defined in `values`
- scripting
- expose instance of navigator [Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard) as `globals.clipboard`
- midi
- allow sending note off with velocity
- add option for receiving note off with velocity

View file

@ -73,7 +73,19 @@ To avoid unwanted script executions, touch state events will only be catched if
## Available variables
Besides the variables available in the [javascript property syntax ](./advanced-syntaxes.md#available-variables) and the ones listed above, the following variables and functions are accessible in this context.
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}`)
- `env`: client options (ie: url query options),
- `ip`: client's ip address,
- `url`: server url,
- `platform`: operating system as seen by the client
- `clipboard`: instance of navigator [Clipboard](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard)
----

View file

@ -12,7 +12,8 @@ class Vm {
env: deepCopy(ENV),
ip: IP,
url: document.location.host,
platform: navigator.platform
platform: navigator.platform,
clipboard: navigator.clipboard
}
}