Commit Graph

18 Commits

Author SHA1 Message Date
J-N-K
5f8214f08a
Adapt to core changes (addon.xml) (#13289)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-01-15 20:31:42 +01:00
Florian Hotze
3c669ad77a
[jsscripting] Cache openhab-js injection to improve performance (#14135)
* [jsscripting] Extend comments for wraprequire
* [jsscripting] Enable openhab-js caching to improve performance

On my dev system (which I guess is much more powerful than most openHAB servers), cached openhab-js injection takes 100-200 ms.
openhab-js injection from file system takes about 1000 ms.

* [jsscripting] Update configuration language
* [jsscripting] Upgrade openhab-js version to 3.2.1 for required webpack changes

Documentation updates will follow in another PR to keep this one clean.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2023-01-02 20:41:35 +01:00
openhab-bot
d20b10317c
New Crowdin updates (#13990)
* New translations tr064.properties (German)
* New translations jsscripting.properties (Danish)
* New translations jsscripting.properties (Italian)
2022-12-17 16:51:35 +01:00
Florian Hotze
11e2c4fc31
[jsscripting] Update add-on name in default translation (#13984)
Leftover from #13764.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2022-12-17 13:40:12 +01:00
openhab-bot
4a13e1a68f
New Crowdin updates (#13971)
* New translations knx.properties (German)
* New translations yamahamusiccast.properties (German)
* New translations hdpowerview.properties (Danish)
* New translations jsscripting.properties (Danish)
2022-12-17 12:13:24 +01:00
openhab-bot
d6db72774a
New Crowdin updates (#13962)
* New translations chromecast.properties (Italian)
* New translations sonos.properties (Italian)
* New translations exec.properties (Italian)
* New translations knx.properties (German)
* New translations jsscripting.properties (German)
* New translations yamahamusiccast.properties (German)
2022-12-15 23:36:49 +01:00
Florian Hotze
bf48eccf8c
[jsscripting] Refactor log formatting & Respect toString polyfills (#13844)
* [jsscripting] Refactor log formatting & Respect toString polyfills
* [jsscripting] Catch errors in log formatting & Improve handling of Java obj
* [jsscripting] Update log format failure message

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2022-12-05 20:46:17 +01:00
Florian Hotze
103619741d
[jsscripting] Fix the console.trace polyfill to log a stack trace & Stringify JS Error (#13749)
* [jsscripting] Fix the `console.trace` polyfill to log a stack trace & Stringify JS `Error`
* [jsscripting] Add myself to the codeowners

Fixes #12646

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2022-11-20 20:30:42 +01:00
Florian Hotze
11d3c641e5
[jsscripting] Fix failure on some platforms & JDKs (#13714)
* [jsscripting] Downgrade GraalVM to fix issue with armv7l & OpenJDK 11.0.16

The community reported several cases where JS Scripting was not working due to some issue with the injection of the global script.
This issue seems to only occur on armv7l (e.g. Raspberry Pi 32bit) and OpenJDK 11.0.16.
Investigation showed that the occurrence of the problem depends on the GraalJS version.

See https://community.openhab.org/t/js-scripting-all-scripts-stop-working-when-upgrading-to-3-4-0-m4/140837.

* [jsscripting] Add logging for injection of JSRuntimeFeatures
* [jsscripting] Lint `@jsscripting-globals.js` with semistandard
* [jsscripting] Remove ICU4J as it moved to `org.graalvm.truffle`

Reference f5661d4655/CHANGELOG.md (version-2200).

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2022-11-14 20:30:44 +01:00
Florian Hotze
51d3fc211a
[jsscripting] Reimplement timer polyfills to conform standard JS (#13623)
* [jsscripting] Reimplement timers to conform standard JS
* [jsscripting] Name scheduled jobs by loggerName + id
* [jsscripting] Update timer identifiers
* [jsscripting] Update identifiers for scheduled jobs
* [jsscripting] Synchronize method that is called when the script is reloaded
* [jsscripting] Cancel all scheduled jobs when the engine is closed
* [jsscripting] Ensure that a timerId is never reused by a subsequent call & Use long primitive type instead of Integer
* [jsscripting] Use an abstraction class to inject features into the JS runtime
* [jsscripting] Make ThreadsafeTimers threadsafe for concurrent access to the class itself
* [jsscripting] Move the locking for `invokeFunction` to `OpenhabGraalJSScriptEngine`

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2022-11-05 15:26:46 +01:00
Florian Hotze
eda5a562a0
[jsscripting] Name timers created by polyfills (#13576)
* [jsscripting] Name timers created by polyfills

Fixes #13478.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2022-10-24 23:40:44 +02:00
Florian Hotze
cf47dc0f39
[jsscripting] Fix multi-thread access (#13582)
* [jsscripting] Share the lock mechanism that was used only for rules
This change moves the lock object that was originally created for ThreadsafeSimpleRuleDelegate to OpenhabGraalJSScriptEngine to make share it across the whole engine.

* [jsscripting] Inject the lock object into the JS runtime
* [jsscripting] Update `setTimeout` & `setInterval` polyfills to enable threadsafety
* [jsscripting] Upgrade GraalJS from 21.3.0 to 22.3.0
* [jsscripting] Reduce compiler warnings
* [jsscripting] Update node version of frontend-maven-plugin

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2022-10-24 13:35:33 +02:00
openhab-bot
936365031c
New Crowdin updates (#13542)
* New translations adorne.properties (Italian)
* New translations knx.properties (German)
* New translations jsscripting.properties (Italian)
2022-10-13 14:35:26 +02:00
Dan Cunningham
a0920d4c0c
[jsscripting] Append the ruleID or file name to the logger when console logging (#11945)
* Appends the ruleID or file name to the logger when console logging.
* Adds configurable logging, updates scriptId logic

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
2022-01-31 11:55:50 +01:00
openhab-bot
c23f6adf13
New Crowdin updates (#11832)
* New translations astro.properties (Finnish)
* New translations astro.properties (German)
* New translations bluetooth.properties (German)
* New translations boschshc.properties (Italian)
* New translations comfoair.properties (German)
* New translations dwdunwetter.properties (German)
* New translations epsonprojector.properties (German)
* New translations gpio.properties (German)
* New translations heliosventilation.properties (German)
* New translations homeconnect.properties (German)
* New translations homematic.properties (German)
* New translations ipp.properties (German)
* New translations jruby.properties (Hungarian)
* New translations jsscripting.properties (German)
* New translations jsscripting.properties (Hungarian)
* New translations map.properties (German)
* New translations map.properties (Hungarian)
* New translations mqttbroker.properties (Italian)
* New translations nanoleaf.properties (German)
* New translations ocean.properties (German)
* New translations openhabcloud.properties (Finnish)
* New translations samsungtv.properties (Hungarian)
* New translations shelly.properties (German)
* New translations snmp.properties (German)
* New translations sonos.properties (German)
* New translations spotify.properties (German)
* New translations tr064.properties (German)
* New translations tradfri.properties (German)
* New translations unifi.properties (German)
* New translations unifi.properties (Hungarian)
* New translations valloxmv.properties (Finnish)
* New translations volvooncall.properties (German)
* New translations xslt.properties (German)
2021-12-29 13:16:52 +01:00
Wouter Born
ccddf85c2a
[jsscripting] Add default translations (#11798)
Signed-off-by: Wouter Born <github@maindrain.net>
2021-12-16 20:06:50 +01:00
Dan Cunningham
4481ecff61
[jsscripting] openhab-js integration (#11656)
Fixes #11222

Signed-off-by: Dan Cunningham <dan@digitaldan.com>
2021-12-13 08:13:13 +01:00
Jonathan Gilbert
9912e1afc2
[jsscripting] ES6+ Support (#8516)
Signed-off-by: Jonathan Gilbert <jpg@trillica.com>
2021-05-06 09:08:47 +02:00