iobroker.javascript 5.4.0 → 5.4.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 +10 -16
- package/admin/asset-manifest.json +10 -10
- package/admin/google-blockly/own/blocks_trigger.js +1 -1
- package/admin/static/js/{2.8a1e22ee.chunk.js → 2.d453b3f2.chunk.js} +2 -2
- package/admin/static/js/{2.8a1e22ee.chunk.js.LICENSE.txt → 2.d453b3f2.chunk.js.LICENSE.txt} +0 -0
- package/admin/static/js/{2.8a1e22ee.chunk.js.map → 2.d453b3f2.chunk.js.map} +1 -1
- package/admin/static/js/{main.b85c3f2a.chunk.js → main.641ff6ac.chunk.js} +2 -2
- package/admin/static/js/{main.b85c3f2a.chunk.js.map → main.641ff6ac.chunk.js.map} +1 -1
- package/admin/static/js/{runtime-main.367f9424.js → runtime-main.0fde2268.js} +1 -1
- package/admin/static/js/{runtime-main.367f9424.js.map → runtime-main.0fde2268.js.map} +1 -1
- package/admin/tab.html +1 -1
- package/docs/en/javascript.md +111 -129
- package/io-package.json +38 -38
- package/lib/scheduler.js +10 -12
- package/main.js +1 -1
- package/package.json +1 -1
package/lib/scheduler.js
CHANGED
|
@@ -83,20 +83,15 @@ class Scheduler {
|
|
|
83
83
|
for (const id in this.list) {
|
|
84
84
|
if (!this.list.hasOwnProperty(id)) continue;
|
|
85
85
|
if (this.checkSchedule(context, this.list[id])) {
|
|
86
|
-
typeof this.list[id].cb === 'function' && this.list[id].cb(id);
|
|
86
|
+
setImmediate(id => this.list[id] && typeof this.list[id].cb === 'function' && this.list[id].cb(id), id);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
const d = new this.Date();
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
d.setMilliseconds(0);
|
|
96
|
-
d.setSeconds(0);
|
|
97
|
-
d.setMinutes(d.getMinutes() + 1);
|
|
98
|
-
this.timer = setTimeout(() => this.checkSchedules(), d.getTime() - this.Date.now());
|
|
99
|
-
}
|
|
91
|
+
d.setMilliseconds(0);
|
|
92
|
+
d.setSeconds(0);
|
|
93
|
+
d.setMinutes(d.getMinutes() + 1);
|
|
94
|
+
this.timer = setTimeout(() => this.checkSchedules(), d.getTime() - this.Date.now());
|
|
100
95
|
}
|
|
101
96
|
|
|
102
97
|
monthDiff(d1, d2) {
|
|
@@ -145,7 +140,7 @@ class Scheduler {
|
|
|
145
140
|
}
|
|
146
141
|
}
|
|
147
142
|
} else if (schedule.period.months) {
|
|
148
|
-
if (schedule.period.months && schedule.period.months.indexOf(context.M) === -1) {
|
|
143
|
+
if (Array.isArray(schedule.period.months) && schedule.period.months.indexOf(context.M) === -1) {
|
|
149
144
|
return;
|
|
150
145
|
}
|
|
151
146
|
if (schedule.period.fromDate && typeof schedule.period.months === 'number' && schedule.period.months > 1) {
|
|
@@ -154,6 +149,9 @@ class Scheduler {
|
|
|
154
149
|
return;
|
|
155
150
|
}
|
|
156
151
|
}
|
|
152
|
+
if (schedule.period.dates && schedule.period.dates.indexOf(context.d) === -1) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
157
155
|
} else if (schedule.period.years) {
|
|
158
156
|
if (schedule.period.yearMonth !== undefined && schedule.period.yearMonth !== context.M) {
|
|
159
157
|
return;
|
|
@@ -327,7 +325,7 @@ class Scheduler {
|
|
|
327
325
|
return;
|
|
328
326
|
}
|
|
329
327
|
}
|
|
330
|
-
if (sch.period.months) {
|
|
328
|
+
if (sch.period.months && typeof sch.period.months !== 'number') { // can be number or array-string
|
|
331
329
|
try {
|
|
332
330
|
sch.period.months = JSON.parse(sch.period.months);
|
|
333
331
|
} catch (e) {
|
package/main.js
CHANGED
|
@@ -1376,7 +1376,7 @@ function createActiveObject(id, enabled, cb) {
|
|
|
1376
1376
|
if (state && state.val !== enabled) {
|
|
1377
1377
|
const intermediateStateValue = prepareStateObject(idActive, !!enabled, true);
|
|
1378
1378
|
adapter.setForeignState(idActive, !!enabled, true, () => {
|
|
1379
|
-
if (
|
|
1379
|
+
if (enabled) {
|
|
1380
1380
|
context.interimStateValues[id] = intermediateStateValue;
|
|
1381
1381
|
}
|
|
1382
1382
|
cb && cb();
|