iobroker.javascript 5.3.0 → 5.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/admin/asset-manifest.json +3 -3
- package/admin/static/js/{main.5612001b.chunk.js → main.55d1a215.chunk.js} +2 -2
- package/admin/static/js/{main.5612001b.chunk.js.map → main.55d1a215.chunk.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/docs/en/javascript.md +17 -1
- package/io-package.json +37 -37
- package/lib/sandbox.js +38 -19
- package/main.js +1 -1
- package/package.json +4 -4
package/admin/tab.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"><link rel="shortcut icon" href="favicon.ico"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="manifest.json"><script type="text/javascript" onerror="setTimeout(function(){window.location.reload()}, 5000)" src="./../../lib/js/socket.io.js"></script><title>Scripts</title><script type="text/javascript" src="google-blockly/blockly_compressed.js"></script><script type="text/javascript" src="google-blockly/msg/js/en.js"></script><script type="text/javascript" src="google-blockly/blocks_compressed.js"></script><script type="text/javascript" src="google-blockly/javascript_compressed.js"></script><script type="text/javascript" src="google-blockly/own/blocks_words.js"></script><script type="text/javascript" src="google-blockly/own/field_oid.js"></script><script type="text/javascript" src="google-blockly/own/field_cron.js"></script><script type="text/javascript" src="google-blockly/own/field_script.js"></script><script type="text/javascript" src="google-blockly/own/blocks_system.js"></script><script type="text/javascript" src="google-blockly/own/blocks_action.js"></script><script type="text/javascript" src="google-blockly/own/blocks_sendto.js"></script><script type="text/javascript" src="google-blockly/own/blocks_time.js"></script><script type="text/javascript" src="google-blockly/own/blocks_convert.js"></script><script type="text/javascript" src="google-blockly/own/blocks_trigger.js"></script><script type="text/javascript" src="google-blockly/own/blocks_procedures.js"></script><script type="text/javascript" src="google-blockly/own/blocks_timeout.js"></script><script type="text/javascript" src="google-blockly/own/blocks_switch.js"></script><style>.iobVerticalSplitter .layout-pane-primary{overflow:hidden!important}</style><link href="static/css/2.a442f2b4.chunk.css" rel="stylesheet"><link href="static/css/main.5b5813ce.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><script>"dark"===(window.localStorage&&window.localStorage.getItem("App.theme"))&&(window.document.body.style.background="black")</script><div id="root"></div><xml id="toolbox" style="display:none"><category><block>%%CUSTOM_BLOCKS%%</block></category><sep></sep><category name="{catLogic}" colour="210"><block type="controls_if"></block><block type="logic_compare"></block><block type="logic_operation"></block><block type="logic_negate"></block><block type="logic_boolean"></block><block type="logic_null"></block><block type="logic_ternary"></block><block type="logic_switch_case"></block></category><category name="{catLoops}" colour="120"><block type="controls_repeat_ext"><value name="TIMES"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="controls_whileUntil"></block><block type="controls_for"><value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="TO"><shadow type="math_number"><field name="NUM">10</field></shadow></value><value name="BY"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="controls_forEach"></block><block type="controls_flow_statements"></block></category><category name="{catMath}" colour="230"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_single"><value name="NUM"><shadow type="math_number"><field name="NUM">9</field></shadow></value></block><block type="math_trig"><value name="NUM"><shadow type="math_number"><field name="NUM">45</field></shadow></value></block><block type="math_constant"></block><block type="math_number_property"><value name="NUMBER_TO_CHECK"><shadow type="math_number"><field name="NUM">0</field></shadow></value></block><block type="math_change"><value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_round"><value name="NUM"><shadow type="math_number"><field name="NUM">3.1</field></shadow></value></block><block type="math_rndfixed"><value name="x"><shadow type="math_number"><field name="NUM">3.1234</field></shadow></value><value name="n"><shadow type="math_number"><field name="NUM">2</field></shadow></value></block><block type="math_on_list"></block><block type="math_modulo"><value name="DIVIDEND"><shadow type="math_number"><field name="NUM">64</field></shadow></value><value name="DIVISOR"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="math_constrain"><value name="VALUE"><shadow type="math_number"><field name="NUM">50</field></shadow></value><value name="LOW"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="HIGH"><shadow type="math_number"><field name="NUM">100</field></shadow></value></block><block type="math_random_int"><value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="TO"><shadow type="math_number"><field name="NUM">100</field></shadow></value></block><block type="math_random_float"></block></category><category name="{catText}" colour="160"><block type="text"></block><block type="text_newline"></block><block type="text_multiline"></block><block type="text_join"></block><block type="text_append"><value name="TEXT"><shadow type="text"></shadow></value></block><block type="text_length"><value name="VALUE"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block><block type="text_isEmpty"><value name="VALUE"><shadow type="text"><field name="TEXT"></field></shadow></value></block><block type="text_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">{textVariable}</field></block></value><value name="FIND"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block><block type="text_charAt"><value name="VALUE"><block type="variables_get"><field name="VAR">{textVariable}</field></block></value></block><block type="text_getSubstring"><value name="STRING"><block type="variables_get"><field name="VAR">{textVariable}</field></block></value></block><block type="text_changeCase"><value name="TEXT"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block><block type="text_trim"><value name="TEXT"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block></category><category name="{catLists}" colour="260"><block type="lists_create_with"><mutation items="0"></mutation></block><block type="lists_create_with"></block><block type="lists_repeat"><value name="NUM"><shadow type="math_number"><field name="NUM">5</field></shadow></value></block><block type="lists_length"></block><block type="lists_isEmpty"></block><block type="lists_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">{listVariable}</field></block></value></block><block type="lists_getIndex"><value name="VALUE"><block type="variables_get"><field name="VAR">{listVariable}</field></block></value></block><block type="lists_setIndex"><value name="LIST"><block type="variables_get"><field name="VAR">{listVariable}</field></block></value></block><block type="lists_getSublist"><value name="LIST"><block type="variables_get"><field name="VAR">{listVariable}</field></block></value></block><block type="lists_split"><value name="DELIM"><shadow type="text"><field name="TEXT">,</field></shadow></value></block><block type="lists_sort"></block></category><category name="{catColour}" colour="20"><block type="colour_picker"></block><block type="colour_random"></block><block type="colour_rgb"><value name="RED"><shadow type="math_number"><field name="NUM">100</field></shadow></value><value name="GREEN"><shadow type="math_number"><field name="NUM">50</field></shadow></value><value name="BLUE"><shadow type="math_number"><field name="NUM">0</field></shadow></value></block><block type="colour_blend"><value name="COLOUR1"><shadow type="colour_picker"><field name="COLOUR">#ff0000</field></shadow></value><value name="COLOUR2"><shadow type="colour_picker"><field name="COLOUR">#3333ff</field></shadow></value><value name="RATIO"><shadow type="math_number"><field name="NUM">0.5</field></shadow></value></block></category><sep></sep><category name="{catVariables}" colour="330" custom="VARIABLE"></category><category name="{catFunctions}" colour="290" custom="PROCEDURE"></category></xml><script>!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var f=this.webpackJsonpjs=this.webpackJsonpjs||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([])</script><script src="static/js/2.b35d4219.chunk.js"></script><script src="static/js/main.5612001b.chunk.js"></script><script type="text/javascript" src="vs/loader.js"></script><script type="text/javascript" src="vs/configure.js"></script></body></html>
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"><link rel="shortcut icon" href="favicon.ico"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="manifest.json"><script type="text/javascript" onerror="setTimeout(function(){window.location.reload()}, 5000)" src="./../../lib/js/socket.io.js"></script><title>Scripts</title><script type="text/javascript" src="google-blockly/blockly_compressed.js"></script><script type="text/javascript" src="google-blockly/msg/js/en.js"></script><script type="text/javascript" src="google-blockly/blocks_compressed.js"></script><script type="text/javascript" src="google-blockly/javascript_compressed.js"></script><script type="text/javascript" src="google-blockly/own/blocks_words.js"></script><script type="text/javascript" src="google-blockly/own/field_oid.js"></script><script type="text/javascript" src="google-blockly/own/field_cron.js"></script><script type="text/javascript" src="google-blockly/own/field_script.js"></script><script type="text/javascript" src="google-blockly/own/blocks_system.js"></script><script type="text/javascript" src="google-blockly/own/blocks_action.js"></script><script type="text/javascript" src="google-blockly/own/blocks_sendto.js"></script><script type="text/javascript" src="google-blockly/own/blocks_time.js"></script><script type="text/javascript" src="google-blockly/own/blocks_convert.js"></script><script type="text/javascript" src="google-blockly/own/blocks_trigger.js"></script><script type="text/javascript" src="google-blockly/own/blocks_procedures.js"></script><script type="text/javascript" src="google-blockly/own/blocks_timeout.js"></script><script type="text/javascript" src="google-blockly/own/blocks_switch.js"></script><style>.iobVerticalSplitter .layout-pane-primary{overflow:hidden!important}</style><link href="static/css/2.a442f2b4.chunk.css" rel="stylesheet"><link href="static/css/main.5b5813ce.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><script>"dark"===(window.localStorage&&window.localStorage.getItem("App.theme"))&&(window.document.body.style.background="black")</script><div id="root"></div><xml id="toolbox" style="display:none"><category><block>%%CUSTOM_BLOCKS%%</block></category><sep></sep><category name="{catLogic}" colour="210"><block type="controls_if"></block><block type="logic_compare"></block><block type="logic_operation"></block><block type="logic_negate"></block><block type="logic_boolean"></block><block type="logic_null"></block><block type="logic_ternary"></block><block type="logic_switch_case"></block></category><category name="{catLoops}" colour="120"><block type="controls_repeat_ext"><value name="TIMES"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="controls_whileUntil"></block><block type="controls_for"><value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="TO"><shadow type="math_number"><field name="NUM">10</field></shadow></value><value name="BY"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="controls_forEach"></block><block type="controls_flow_statements"></block></category><category name="{catMath}" colour="230"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_single"><value name="NUM"><shadow type="math_number"><field name="NUM">9</field></shadow></value></block><block type="math_trig"><value name="NUM"><shadow type="math_number"><field name="NUM">45</field></shadow></value></block><block type="math_constant"></block><block type="math_number_property"><value name="NUMBER_TO_CHECK"><shadow type="math_number"><field name="NUM">0</field></shadow></value></block><block type="math_change"><value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_round"><value name="NUM"><shadow type="math_number"><field name="NUM">3.1</field></shadow></value></block><block type="math_rndfixed"><value name="x"><shadow type="math_number"><field name="NUM">3.1234</field></shadow></value><value name="n"><shadow type="math_number"><field name="NUM">2</field></shadow></value></block><block type="math_on_list"></block><block type="math_modulo"><value name="DIVIDEND"><shadow type="math_number"><field name="NUM">64</field></shadow></value><value name="DIVISOR"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="math_constrain"><value name="VALUE"><shadow type="math_number"><field name="NUM">50</field></shadow></value><value name="LOW"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="HIGH"><shadow type="math_number"><field name="NUM">100</field></shadow></value></block><block type="math_random_int"><value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="TO"><shadow type="math_number"><field name="NUM">100</field></shadow></value></block><block type="math_random_float"></block></category><category name="{catText}" colour="160"><block type="text"></block><block type="text_newline"></block><block type="text_multiline"></block><block type="text_join"></block><block type="text_append"><value name="TEXT"><shadow type="text"></shadow></value></block><block type="text_length"><value name="VALUE"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block><block type="text_isEmpty"><value name="VALUE"><shadow type="text"><field name="TEXT"></field></shadow></value></block><block type="text_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">{textVariable}</field></block></value><value name="FIND"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block><block type="text_charAt"><value name="VALUE"><block type="variables_get"><field name="VAR">{textVariable}</field></block></value></block><block type="text_getSubstring"><value name="STRING"><block type="variables_get"><field name="VAR">{textVariable}</field></block></value></block><block type="text_changeCase"><value name="TEXT"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block><block type="text_trim"><value name="TEXT"><shadow type="text"><field name="TEXT">abc</field></shadow></value></block></category><category name="{catLists}" colour="260"><block type="lists_create_with"><mutation items="0"></mutation></block><block type="lists_create_with"></block><block type="lists_repeat"><value name="NUM"><shadow type="math_number"><field name="NUM">5</field></shadow></value></block><block type="lists_length"></block><block type="lists_isEmpty"></block><block type="lists_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">{listVariable}</field></block></value></block><block type="lists_getIndex"><value name="VALUE"><block type="variables_get"><field name="VAR">{listVariable}</field></block></value></block><block type="lists_setIndex"><value name="LIST"><block type="variables_get"><field name="VAR">{listVariable}</field></block></value></block><block type="lists_getSublist"><value name="LIST"><block type="variables_get"><field name="VAR">{listVariable}</field></block></value></block><block type="lists_split"><value name="DELIM"><shadow type="text"><field name="TEXT">,</field></shadow></value></block><block type="lists_sort"></block></category><category name="{catColour}" colour="20"><block type="colour_picker"></block><block type="colour_random"></block><block type="colour_rgb"><value name="RED"><shadow type="math_number"><field name="NUM">100</field></shadow></value><value name="GREEN"><shadow type="math_number"><field name="NUM">50</field></shadow></value><value name="BLUE"><shadow type="math_number"><field name="NUM">0</field></shadow></value></block><block type="colour_blend"><value name="COLOUR1"><shadow type="colour_picker"><field name="COLOUR">#ff0000</field></shadow></value><value name="COLOUR2"><shadow type="colour_picker"><field name="COLOUR">#3333ff</field></shadow></value><value name="RATIO"><shadow type="math_number"><field name="NUM">0.5</field></shadow></value></block></category><sep></sep><category name="{catVariables}" colour="330" custom="VARIABLE"></category><category name="{catFunctions}" colour="290" custom="PROCEDURE"></category></xml><script>!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var f=this.webpackJsonpjs=this.webpackJsonpjs||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([])</script><script src="static/js/2.b35d4219.chunk.js"></script><script src="static/js/main.55d1a215.chunk.js"></script><script type="text/javascript" src="vs/loader.js"></script><script type="text/javascript" src="vs/configure.js"></script></body></html>
|
package/docs/en/javascript.md
CHANGED
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
- [getIdByName](#getidbyname)
|
|
37
37
|
- [getEnums](#getenums)
|
|
38
38
|
- [createState](#createstate)
|
|
39
|
+
- [createStateAsync](#createstateasync)
|
|
39
40
|
- [deleteState](#deletestate)
|
|
41
|
+
- [deleteStateAsync](#deletestateasync)
|
|
40
42
|
- [sendTo](#sendto)
|
|
41
43
|
- [sendToHost](#sendtohost)
|
|
42
44
|
- [setInterval](#setinterval)
|
|
@@ -945,7 +947,7 @@ getEnums('rooms');
|
|
|
945
947
|
```js
|
|
946
948
|
createState(name, initialValue, forceCreation, common, native, callback);
|
|
947
949
|
```
|
|
948
|
-
Create state and object in javascript space if does not exist, e.g. "javascript.0.mystate".
|
|
950
|
+
Create state and object in javascript space if it does not exist, e.g. "javascript.0.mystate".
|
|
949
951
|
|
|
950
952
|
#### Parameters:
|
|
951
953
|
|
|
@@ -963,6 +965,13 @@ It is possible short type of createState:
|
|
|
963
965
|
- `createState('myVariable', {name: 'My own variable', unit: '°C'}, function () {log('created');});`
|
|
964
966
|
- `createState('myVariable', 1, {name: 'My own variable', unit: '°C'})` - create variable if does not exist with specific name and units
|
|
965
967
|
|
|
968
|
+
### createStateAsync
|
|
969
|
+
```js
|
|
970
|
+
await createStateAsync(name, initialValue, forceCreation, common, native);
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
Same as `createState`, but the promise will be returned.
|
|
974
|
+
|
|
966
975
|
### deleteState
|
|
967
976
|
```js
|
|
968
977
|
deleteState(name, callback);
|
|
@@ -974,6 +983,13 @@ deleteState('myVariable')
|
|
|
974
983
|
```
|
|
975
984
|
simply delete variable if exists.
|
|
976
985
|
|
|
986
|
+
### deleteStateAsync
|
|
987
|
+
```js
|
|
988
|
+
await deleteStateAsync(name);
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
Same as `deleteState`, but the promise will be returned.
|
|
992
|
+
|
|
977
993
|
### sendTo
|
|
978
994
|
```js
|
|
979
995
|
sendTo(adapter, command, message, callback);
|
package/io-package.json
CHANGED
|
@@ -20,8 +20,44 @@
|
|
|
20
20
|
"Apollon77 <iobroker@fischer-ka.de>",
|
|
21
21
|
"AlCalzone"
|
|
22
22
|
],
|
|
23
|
-
"version": "5.3.
|
|
23
|
+
"version": "5.3.3",
|
|
24
24
|
"news": {
|
|
25
|
+
"5.3.3": {
|
|
26
|
+
"en": "Added async functions: createStateAsync, deleteStateAsync",
|
|
27
|
+
"de": "Asynchrone Funktionen hinzugefügt: createStateAsync, deleteStateAsync",
|
|
28
|
+
"ru": "Добавлены асинхронные функции: createStateAsync, deleteStateAsync.",
|
|
29
|
+
"pt": "Funções assíncronas adicionadas: createStateAsync, deleteStateAsync",
|
|
30
|
+
"nl": "Toegevoegde asynchrone functies: createStateAsync, deleteStateAsync",
|
|
31
|
+
"fr": "Fonctions asynchrones ajoutées : createStateAsync, deleteStateAsync",
|
|
32
|
+
"it": "Aggiunte funzioni asincrone: createStateAsync, deleteStateAsync",
|
|
33
|
+
"es": "Funciones asincrónicas agregadas: createStateAsync, deleteStateAsync",
|
|
34
|
+
"pl": "Dodano funkcje asynchroniczne: createStateAsync, deleteStateAsync",
|
|
35
|
+
"zh-cn": "添加了异步函数:createStateAsync、deleteStateAsync"
|
|
36
|
+
},
|
|
37
|
+
"5.3.2": {
|
|
38
|
+
"en": "fix problem that scripts were not starting when scriptsEnabled State was triggered (or startScript was used)\nMake sure callbacks on startScript/stopScript work and Async variants also resolve\nMake sure startScriptAsync, stopScriptAsync and runScriptAsync resolve in debug mode too",
|
|
39
|
+
"de": "Behebung des Problems, dass Skripte nicht gestartet wurden, wenn scriptsEnabled State ausgelöst wurde (oder startScript verwendet wurde)\nStellen Sie sicher, dass Callbacks auf startScript/stopScript funktionieren und Async-Varianten ebenfalls aufgelöst werden\nStellen Sie sicher, dass startScriptAsync, stopScriptAsync und runScriptAsync auch im Debugmodus aufgelöst werden",
|
|
40
|
+
"ru": "исправить проблему, из-за которой скрипты не запускались, когда срабатывало состояние scriptsEnabled (или использовался startScript)\nУбедитесь, что обратные вызовы на startScript/stopScript работают, а варианты Async также разрешаются.\nУбедитесь, что startScriptAsync, stopScriptAsync и runScriptAsync разрешаются и в режиме отладки.",
|
|
41
|
+
"pt": "corrigir o problema que os scripts não estavam iniciando quando o estado scriptsEnabled foi acionado (ou startScript foi usado)\nCertifique-se de que os retornos de chamada no startScript/stopScript funcionam e as variantes Async também resolvem\nCertifique-se de que startScriptAsync, stopScriptAsync e runScriptAsync também resolvam no modo de depuração",
|
|
42
|
+
"nl": "probleem oplossen dat scripts niet startten toen scriptsEnabled State werd geactiveerd (of startScript werd gebruikt)\nZorg ervoor dat callbacks op startScript/stopScript werken en dat Async-varianten ook worden opgelost\nZorg ervoor dat startScriptAsync, stopScriptAsync en runScriptAsync ook worden opgelost in de foutopsporingsmodus",
|
|
43
|
+
"fr": "résout le problème que les scripts ne démarraient pas lorsque l'état scriptsEnabled était déclenché (ou que startScript était utilisé)\nAssurez-vous que les rappels sur startScript/stopScript fonctionnent et que les variantes Async se résolvent également\nAssurez-vous que startScriptAsync, stopScriptAsync et runScriptAsync se résolvent également en mode débogage",
|
|
44
|
+
"it": "risolvere il problema per cui gli script non si avviavano quando è stato attivato lo stato scriptsEnabled (o è stato utilizzato startScript)\nAssicurati che anche i callback su startScript/stopScript funzionino e le varianti Async vengano risolte\nAssicurati che startScriptAsync, stopScriptAsync e runScriptAsync si risolvano anche in modalità di debug",
|
|
45
|
+
"es": "solucionar el problema de que los scripts no se iniciaban cuando se activaba scriptsEnabled State (o se usaba startScript)\nAsegúrese de que las devoluciones de llamada en startScript/stopScript funcionen y las variantes asíncronas también se resuelvan\nAsegúrese de que startScriptAsync, stopScriptAsync y runScriptAsync también se resuelvan en modo de depuración.",
|
|
46
|
+
"pl": "naprawienie problemu polegającego na tym, że skrypty nie uruchamiały się po wywołaniu scriptsEnabled State (lub użyciu startScript)\nUpewnij się, że wywołania zwrotne w startScript/stopScript działają, a warianty Async również się rozwiązują\nUpewnij się, że startScriptAsync, stopScriptAsync i runScriptAsync są również rozwiązywane w trybie debugowania",
|
|
47
|
+
"zh-cn": "修复触发scriptsEnabled状态(或使用startScript)时脚本未启动的问题\n确保 startScript/stopScript 上的回调正常工作并且异步变体也可以解决\n确保 startScriptAsync、stopScriptAsync 和 runScriptAsync 也在调试模式下解析"
|
|
48
|
+
},
|
|
49
|
+
"5.3.1": {
|
|
50
|
+
"en": "Add missing callback check in setObject",
|
|
51
|
+
"de": "Fehlende Callback-Prüfung in setObject hinzugefügt",
|
|
52
|
+
"ru": "Добавить отсутствующую проверку обратного вызова в setObject",
|
|
53
|
+
"pt": "Adicionar verificação de retorno de chamada ausente em setObject",
|
|
54
|
+
"nl": "Voeg ontbrekende terugbelcontrole toe in setObject",
|
|
55
|
+
"fr": "Ajouter une vérification de rappel manquante dans setObject",
|
|
56
|
+
"it": "Aggiungi il controllo della richiamata mancante in setObject",
|
|
57
|
+
"es": "Agregar verificación de devolución de llamada faltante en setObject",
|
|
58
|
+
"pl": "Dodaj brakujące sprawdzenie wywołania zwrotnego w setObject",
|
|
59
|
+
"zh-cn": "在 setObject 中添加缺少的回调检查"
|
|
60
|
+
},
|
|
25
61
|
"5.3.0": {
|
|
26
62
|
"en": "Prevent some crash cases reported by Sentry (IOBROKER-JAVASCRIPT-A3)\nFix Enum Updates\nOptimize making sure data are current for synchronous return of states/objects even for asynchronous action cases before\nMake sure admin files is cleaned up on update\nupdate channel/device structures for $ selector on object updates\nAdjustments for js-controller 4.0",
|
|
27
63
|
"de": "Einige von Sentry gemeldete Absturzfälle verhindern (IOBROKER-JAVASCRIPT-A3)\nEnum-Updates beheben\nOptimieren Sie, indem Sie sicherstellen, dass die Daten für die synchrone Rückgabe von Zuständen/Objekten auch für asynchrone Aktionsfälle zuvor aktuell sind\nStellen Sie sicher, dass die Verwaltungsdateien beim Update bereinigt werden\nKanal-/Gerätestrukturen für $-Selektor bei Objektaktualisierungen aktualisieren\nAnpassungen für js-controller 4.0",
|
|
@@ -69,42 +105,6 @@
|
|
|
69
105
|
"es": "Arreglar la dependencia rota",
|
|
70
106
|
"pl": "Napraw zepsutą zależność",
|
|
71
107
|
"zh-cn": "修复损坏的依赖"
|
|
72
|
-
},
|
|
73
|
-
"5.2.18": {
|
|
74
|
-
"en": "Fixed some german translations\nFixed astro schedules",
|
|
75
|
-
"de": "Einige deutsche Übersetzungen korrigiert\nFeste Astrozeitpläne",
|
|
76
|
-
"ru": "Исправлены некоторые немецкие переводы\nФиксированные астро-графики",
|
|
77
|
-
"pt": "Corrigidas algumas traduções para o alemão\nProgramações de astro corrigidas",
|
|
78
|
-
"nl": "Enkele Duitse vertalingen gerepareerd\nVaste astro-schema's",
|
|
79
|
-
"fr": "Correction de certaines traductions allemandes\nHoraires astro fixes",
|
|
80
|
-
"it": "Risolte alcune traduzioni in tedesco\nOrari astronomici fissi",
|
|
81
|
-
"es": "Se corrigieron algunas traducciones alemanas.\nHorarios astro fijos",
|
|
82
|
-
"pl": "Naprawiono niektóre niemieckie tłumaczenia\nStałe harmonogramy astro",
|
|
83
|
-
"zh-cn": "修正了一些德语翻译\n固定的天文时间表"
|
|
84
|
-
},
|
|
85
|
-
"5.2.17": {
|
|
86
|
-
"en": "Fixed some german translations\nFixed astro schedules",
|
|
87
|
-
"de": "Einige deutsche Übersetzungen korrigiert\nFeste Astrozeitpläne",
|
|
88
|
-
"ru": "Исправлены некоторые немецкие переводы\nФиксированные астро-графики",
|
|
89
|
-
"pt": "Corrigidas algumas traduções para o alemão\nProgramações de astro corrigidas",
|
|
90
|
-
"nl": "Enkele Duitse vertalingen gerepareerd\nVaste astro-schema's",
|
|
91
|
-
"fr": "Correction de certaines traductions allemandes\nHoraires astro fixes",
|
|
92
|
-
"it": "Risolte alcune traduzioni in tedesco\nOrari astronomici fissi",
|
|
93
|
-
"es": "Se corrigieron algunas traducciones alemanas.\nHorarios astro fijos",
|
|
94
|
-
"pl": "Naprawiono niektóre niemieckie tłumaczenia\nStałe harmonogramy astro",
|
|
95
|
-
"zh-cn": "修正了一些德语翻译\n固定的天文时间表"
|
|
96
|
-
},
|
|
97
|
-
"5.2.16": {
|
|
98
|
-
"en": "Fixed fonts",
|
|
99
|
-
"de": "Feste Schriftarten",
|
|
100
|
-
"ru": "Фиксированные шрифты",
|
|
101
|
-
"pt": "Fontes fixas",
|
|
102
|
-
"nl": "Vaste lettertypen",
|
|
103
|
-
"fr": "Polices fixes",
|
|
104
|
-
"it": "Caratteri fissi",
|
|
105
|
-
"es": "Fuentes fijas",
|
|
106
|
-
"pl": "Naprawiono czcionki",
|
|
107
|
-
"zh-cn": "固定字体"
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
"desc": {
|
package/lib/sandbox.js
CHANGED
|
@@ -1884,6 +1884,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1884
1884
|
}
|
|
1885
1885
|
return;
|
|
1886
1886
|
}
|
|
1887
|
+
|
|
1887
1888
|
if (!name) {
|
|
1888
1889
|
const err = 'Empty ID is not allowed.';
|
|
1889
1890
|
sandbox.log(err, 'error');
|
|
@@ -1896,6 +1897,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1896
1897
|
}
|
|
1897
1898
|
return;
|
|
1898
1899
|
}
|
|
1900
|
+
|
|
1899
1901
|
common = common || {};
|
|
1900
1902
|
common.name = common.name || name;
|
|
1901
1903
|
common.role = common.role || 'state';
|
|
@@ -1917,7 +1919,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1917
1919
|
if (typeof min !== 'number') {
|
|
1918
1920
|
min = parseFloat(min);
|
|
1919
1921
|
if (isNaN(min)) {
|
|
1920
|
-
err =
|
|
1922
|
+
err = `Wrong type of ${name}.common.min`;
|
|
1921
1923
|
sandbox.log(err, 'error');
|
|
1922
1924
|
if (typeof callback === 'function') {
|
|
1923
1925
|
try {
|
|
@@ -1937,7 +1939,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1937
1939
|
if (typeof max !== 'number') {
|
|
1938
1940
|
max = parseFloat(max);
|
|
1939
1941
|
if (isNaN(max)) {
|
|
1940
|
-
err =
|
|
1942
|
+
err = `Wrong type of ${name}.common.max`;
|
|
1941
1943
|
sandbox.log(err, 'error');
|
|
1942
1944
|
if (typeof callback === 'function') {
|
|
1943
1945
|
try {
|
|
@@ -1957,7 +1959,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
1957
1959
|
if (typeof def !== 'number') {
|
|
1958
1960
|
def = parseFloat(def);
|
|
1959
1961
|
if (isNaN(def)) {
|
|
1960
|
-
err =
|
|
1962
|
+
err = `Wrong type of ${name}.common.def`;
|
|
1961
1963
|
sandbox.log(err, 'error');
|
|
1962
1964
|
if (typeof callback === 'function') {
|
|
1963
1965
|
try {
|
|
@@ -2044,6 +2046,10 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2044
2046
|
}
|
|
2045
2047
|
});
|
|
2046
2048
|
},
|
|
2049
|
+
createStateAsync: function (name, initValue, forceCreation, common, native) {
|
|
2050
|
+
return new Promise((resolve, reject) =>
|
|
2051
|
+
sandbox.createState(name, initValue, forceCreation, common, native, (err, id) => err ? reject(err) : resolve(id)));
|
|
2052
|
+
},
|
|
2047
2053
|
deleteState: function (id, callback) {
|
|
2048
2054
|
// todo: check rights
|
|
2049
2055
|
// todo: also remove from "names"
|
|
@@ -2102,11 +2108,15 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2102
2108
|
try {
|
|
2103
2109
|
callback.call(sandbox, err, found);
|
|
2104
2110
|
} catch (e) {
|
|
2105
|
-
errorInCallback(e); //adapter.log.error('Error in callback: ' + e)
|
|
2111
|
+
errorInCallback(e); // adapter.log.error('Error in callback: ' + e)
|
|
2106
2112
|
}
|
|
2107
2113
|
}
|
|
2108
2114
|
}
|
|
2109
2115
|
},
|
|
2116
|
+
deleteStateAsync: function (id) {
|
|
2117
|
+
return new Promise((resolve, reject) =>
|
|
2118
|
+
sandbox.deleteState(id, (err, found) => err ? reject(err) : resolve(found)));
|
|
2119
|
+
},
|
|
2110
2120
|
sendTo: function (_adapter, cmd, msg, callback) {
|
|
2111
2121
|
sandbox.verbose && sandbox.log(`sendTo(adapter=${_adapter}, cmd=${cmd}, msg=${JSON.stringify(msg)})`, 'info');
|
|
2112
2122
|
adapter.sendTo(_adapter, cmd, msg, callback);
|
|
@@ -2639,18 +2649,19 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2639
2649
|
} else {
|
|
2640
2650
|
if (debug) {
|
|
2641
2651
|
sandbox.log('runScript(scriptName=' + scriptName + ') - ' + words._('was not executed, while debug mode is active'), 'warn');
|
|
2652
|
+
typeof callback === 'function' && callback();
|
|
2642
2653
|
} else {
|
|
2643
2654
|
if (objects[scriptName].common.enabled) {
|
|
2644
2655
|
objects[scriptName].common.enabled = false;
|
|
2645
2656
|
adapter.extendForeignObject(scriptName, {common: {enabled: false}}, function (/* err, obj */) {
|
|
2646
2657
|
adapter.extendForeignObject(scriptName, {common: {enabled: true}}, function (err) {
|
|
2647
|
-
callback === 'function' && callback(err);
|
|
2658
|
+
typeof callback === 'function' && callback(err);
|
|
2648
2659
|
});
|
|
2649
2660
|
scriptName = null;
|
|
2650
2661
|
});
|
|
2651
2662
|
} else {
|
|
2652
2663
|
adapter.extendForeignObject(scriptName, {common: {enabled: true}}, function (err) {
|
|
2653
|
-
callback === 'function' && callback(err);
|
|
2664
|
+
typeof callback === 'function' && callback(err);
|
|
2654
2665
|
});
|
|
2655
2666
|
}
|
|
2656
2667
|
}
|
|
@@ -2666,7 +2677,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2666
2677
|
resolve();
|
|
2667
2678
|
}
|
|
2668
2679
|
});
|
|
2669
|
-
if (result === false)
|
|
2680
|
+
if (result === false) {
|
|
2681
|
+
reject(`Script ${scriptName} was not found!`);
|
|
2682
|
+
}
|
|
2670
2683
|
});
|
|
2671
2684
|
},
|
|
2672
2685
|
startScript: function (scriptName, ignoreIfStarted, callback) {
|
|
@@ -2683,21 +2696,22 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2683
2696
|
} else {
|
|
2684
2697
|
if (debug) {
|
|
2685
2698
|
sandbox.log(`startScript(scriptName=${scriptName}) - ${words._('was not executed, while debug mode is active')}`, 'warn');
|
|
2699
|
+
callback(null, false);
|
|
2686
2700
|
} else {
|
|
2687
2701
|
if (objects[scriptName].common.enabled) {
|
|
2688
2702
|
if (!ignoreIfStarted) {
|
|
2689
2703
|
objects[scriptName].common.enabled = false;
|
|
2690
2704
|
adapter.extendForeignObject(scriptName, {common: {enabled: false}}, () => {
|
|
2691
2705
|
adapter.extendForeignObject(scriptName, {common: {enabled: true}}, err =>
|
|
2692
|
-
callback === 'function' && callback(err, true));
|
|
2706
|
+
typeof callback === 'function' && callback(err, true));
|
|
2693
2707
|
scriptName = null;
|
|
2694
2708
|
});
|
|
2695
|
-
} else if (callback === 'function') {
|
|
2709
|
+
} else if (typeof callback === 'function') {
|
|
2696
2710
|
callback(null, false);
|
|
2697
2711
|
}
|
|
2698
2712
|
} else {
|
|
2699
2713
|
adapter.extendForeignObject(scriptName, {common: {enabled: true}}, err => {
|
|
2700
|
-
callback === 'function' && callback(err, true);
|
|
2714
|
+
typeof callback === 'function' && callback(err, true);
|
|
2701
2715
|
});
|
|
2702
2716
|
}
|
|
2703
2717
|
}
|
|
@@ -2730,14 +2744,15 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2730
2744
|
} else {
|
|
2731
2745
|
if (debug) {
|
|
2732
2746
|
sandbox.log('stopScript(scriptName=' + scriptName + ') - ' + words._('was not executed, while debug mode is active'), 'warn');
|
|
2747
|
+
callback(null, false);
|
|
2733
2748
|
} else {
|
|
2734
2749
|
if (objects[scriptName].common.enabled) {
|
|
2735
2750
|
objects[scriptName].common.enabled = false;
|
|
2736
2751
|
adapter.extendForeignObject(scriptName, {common: {enabled: false}}, function (err) {
|
|
2737
|
-
callback === 'function' && callback(err, true);
|
|
2752
|
+
typeof callback === 'function' && callback(err, true);
|
|
2738
2753
|
scriptName = null;
|
|
2739
2754
|
});
|
|
2740
|
-
} else if (callback === 'function') {
|
|
2755
|
+
} else if (typeof callback === 'function') {
|
|
2741
2756
|
callback(null, false);
|
|
2742
2757
|
}
|
|
2743
2758
|
}
|
|
@@ -2753,7 +2768,9 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2753
2768
|
resolve(stopped);
|
|
2754
2769
|
}
|
|
2755
2770
|
});
|
|
2756
|
-
if (result === false)
|
|
2771
|
+
if (result === false) {
|
|
2772
|
+
reject(`Script ${scriptName} was not found!`);
|
|
2773
|
+
}
|
|
2757
2774
|
});
|
|
2758
2775
|
},
|
|
2759
2776
|
isScriptActive: function (scriptName) {
|
|
@@ -2791,7 +2808,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2791
2808
|
obj = JSON.parse(obj);
|
|
2792
2809
|
} catch (e) {
|
|
2793
2810
|
adapter.setState('scriptProblem.' + name.substring('script.js.'.length), true, true);
|
|
2794
|
-
sandbox.log(
|
|
2811
|
+
sandbox.log(`Cannot parse "${obj.substring(0, 30)}"${e}`, 'error');
|
|
2795
2812
|
return null;
|
|
2796
2813
|
}
|
|
2797
2814
|
}
|
|
@@ -2877,7 +2894,7 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
2877
2894
|
adapter.sendTo(instance, 'jsMessageBus', {message: target.message, script: target.script, data}, timeout && function (result) {
|
|
2878
2895
|
timeout && clearTimeout(timeout);
|
|
2879
2896
|
|
|
2880
|
-
if (
|
|
2897
|
+
if (typeof callback === 'function') {
|
|
2881
2898
|
sandbox.verbose && sandbox.log('messageTo => ' + JSON.stringify(result), 'debug');
|
|
2882
2899
|
|
|
2883
2900
|
try {
|
|
@@ -3052,10 +3069,12 @@ function sandBox(script, name, verbose, debug, context) {
|
|
|
3052
3069
|
// Update meta object data
|
|
3053
3070
|
context.updateObjectContext(id, obj);
|
|
3054
3071
|
}
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3072
|
+
if (typeof callback === 'function') {
|
|
3073
|
+
try {
|
|
3074
|
+
callback.call(sandbox, err, res);
|
|
3075
|
+
} catch (e) {
|
|
3076
|
+
errorInCallback(e); //adapter.log.error('Error in callback: ' + e)
|
|
3077
|
+
}
|
|
3059
3078
|
}
|
|
3060
3079
|
});
|
|
3061
3080
|
}
|
package/main.js
CHANGED
|
@@ -421,7 +421,7 @@ function startAdapter(options) {
|
|
|
421
421
|
(formerObj.common.engine !== 'system.adapter.' + adapter.namespace && obj.common.engine === 'system.adapter.' + adapter.namespace)) {
|
|
422
422
|
// Script enabled
|
|
423
423
|
|
|
424
|
-
if (
|
|
424
|
+
if (obj.common.enabled && obj.common.engine === 'system.adapter.' + adapter.namespace) {
|
|
425
425
|
// Start script
|
|
426
426
|
load(id);
|
|
427
427
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.javascript",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.3",
|
|
4
4
|
"description": "Rules Engine for ioBroker",
|
|
5
5
|
"author": "bluefox <dogafox@gmail.com>",
|
|
6
6
|
"contributors": [
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"wake_on_lan": "^1.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@alcalzone/release-script": "^3.5.
|
|
49
|
-
"@alcalzone/release-script-plugin-iobroker": "^3.5.
|
|
50
|
-
"@alcalzone/release-script-plugin-license": "^3.5.
|
|
48
|
+
"@alcalzone/release-script": "^3.5.6",
|
|
49
|
+
"@alcalzone/release-script-plugin-iobroker": "^3.5.6",
|
|
50
|
+
"@alcalzone/release-script-plugin-license": "^3.5.3",
|
|
51
51
|
"@types/iobroker": "^4.0.1",
|
|
52
52
|
"alcalzone-shared": "^4.0.1",
|
|
53
53
|
"chai": "^4.3.6",
|