История
6 июня 2019
Новая страница: «<syntaxhighlight lang="js"> defineVirtualDevice("vdev", { ... cells: { ... mycell: { type: "value", value: "10",…»
−58
Новая страница: «If it is necessary to restore a strictly defined value (i.e. not to restore the previous saved value) every time the script is restarted, you can add the forceDef…»
−160
Новая страница: «In previous versions of wb-rules, the values of virtual device controls were stored only in MQTT retained, which is not very reliable (in the case of power loss d…»
−253
Новая страница: «== Virtual devices ==»
−28
Новая страница: «Only global repositories, that is, visible by the same name from all script files, are supported.»
−100
Новая страница: «WB-rules 1.7 adds support for persistent storage. In fact, these are the objects in which the values will be stored even if the controller loses power. These stor…»
−198
Нет описания правки
−38
Новая страница: «<!-- == Постоянное хранилище данных == -->»
+10
Новая страница: «Thus, the first way of addressing will only work if myVar is not defined in the upper scopes.»
−139
Новая страница: «The search stops as soon as the variable is found.»
−49
Новая страница: «# Check if there is myVar among local variables (defined as var myVar = ...). # If not, check if there is myVar in the global object (defined as myVar = ...). # I…»
−206
Новая страница: «The variable search rule in the first case will look like this:»
−52
Новая страница: «// or like this, which is a bit more accurate, because it clearly shows where the variable is defined log("shared myVar: {}", global.__proto__.myVar); </syntaxhig…»
−69
Новая страница: «// the variable can be accessed from other scripts as follows log("shared myVar: {}", myVar);»
−40
Новая страница: «<syntaxhighlight lang="js"> global.__proto__.myVar = 42; // now myVar - is a common variable for all scripts»
−39
Новая страница: «Global objects of all scenarios have a common object-"prototype", in which standard functions are defined wb-rules (such as defineRule, setTimeout, etc.). It can…»
−182
Новая страница: «'''WARNING:''' method is considered "dirty" because all variables and functions published in this way, become available to all scenarios in the system. Try to avo…»
−241
Новая страница: «==== A prototype of the global object ====»
−22
Новая страница: «ps.myvar = "value"; // this value is available for users of "my-global-storage" </syntaxhighlight>»
−82
Новая страница: «'''Warning:''' when using global persistent stores, a name match may occur, in this case, a hard-to-detect behavior violation is possible.»
−161
Новая страница: «You can also use global persistent storages to exchange data.»
−102
Нет описания правки
Новая страница: «==== permanent repository ====»
−19
Новая страница: «If your system used a shared global space to store shared data and functions, there are several ways to implement this behavior:»
−161
Новая страница: «=== workarounds ===»
−14
Новая страница: «Starting from version 1.7, such a construction is usually not necessary. However, the old scripts, using this construction, will continue to work without changes…»
−144
Новая страница: «In previous versions of wb-rules, it was recommended to use loopback to isolate rules, i.e. to isolate rules. wrapping the script code into a construct: <syntaxh…»
−115
Новая страница: «=== Note ===»
−16
Новая страница: «Now: <pre> 2019-01-05 17:28:42myFuncTwo called 2019-01-05 17:28:42test1: 84, test2: Hello 2019-01-05 17:28:42myFuncOne called 2019-01-05 17:28:42test1: 42 2019-01…»
−7
Новая страница: «Before: <pre> 2019-01-05 17:29:50myFuncTwo called 2019-01-05 17:29:50test1: 84, test2: Hello 2019-01-05 17:29:50myFuncOne called 2019-01-05 17:29:50test1: 84 2019…»
−2
Новая страница: «''' rules2.js''' <syntaxhighlight lang="js"> test1 = 84; test2 = "Hello";»
−28
Новая страница: «'''rules1.js''' <syntaxhighlight lang="js"> var test1 = 42;»
−21
Новая страница: «The comments indicate the output of the log commands for earlier versions and for the current version. Note the 'var' before the variables.»
−85
Новая страница: «In previous versions of wb-rules, refering to a global variable, that is modified in several script files, may cause undefined behavior. Starting from v.1.7, th…»
−189
Новая страница: «As an example, here are two scenarios that run simultaneously in the rules engine. Each scenario defines variables and functions.»
−116
Новая страница: «=== Example ===»
−5
Новая страница: «Starting with wb-rules v.1.7, local variables and functions declared in the script file are not visible in other scripts. Thus, each script can define its own fun…»
−191
Новая страница: «== Isolation of scripts ==»
−15
Новая страница: «= Scripts =»
−9
Новая страница: «The updated wb-rules engine contains a number of important innovations regarding the logic of scripting.»
−100
Новая страница: «Wb-rules 1.7 rules engine»
+9127