mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[jsscripting] Fix timerId not returned by JS timer methods (#15308)
Regression from #15193. Reported on the community, see https://community.openhab.org/t/openhab-4-0-release-discussion/147957/53?u=florian-h05. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This commit is contained in:
parent
8f5fab45fa
commit
974847fc0a
@ -29,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
// JSON.stringify all objects that do not polyfill toString()
|
// JSON.stringify all objects that do not polyfill toString()
|
||||||
const str = value.toString();
|
const str = value.toString();
|
||||||
if (typeof value === 'object' && (str === '[object Object]') || str === '[object Java]') {
|
if (typeof value === 'object' && (str === '[object Object]' || str === '[object Java]')) {
|
||||||
return JSON.stringify(value, null, 2);
|
return JSON.stringify(value, null, 2);
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
@ -164,11 +164,11 @@
|
|||||||
// Polyfill common NodeJS functions onto the global object
|
// Polyfill common NodeJS functions onto the global object
|
||||||
globalThis.console = console;
|
globalThis.console = console;
|
||||||
globalThis.setTimeout = function (functionRef, delay, ...args) {
|
globalThis.setTimeout = function (functionRef, delay, ...args) {
|
||||||
ThreadsafeTimers.setTimeout(() => functionRef(...args), delay);
|
return ThreadsafeTimers.setTimeout(() => functionRef(...args), delay);
|
||||||
};
|
};
|
||||||
globalThis.clearTimeout = ThreadsafeTimers.clearTimeout;
|
globalThis.clearTimeout = ThreadsafeTimers.clearTimeout;
|
||||||
globalThis.setInterval = function (functionRef, delay, ...args) {
|
globalThis.setInterval = function (functionRef, delay, ...args) {
|
||||||
ThreadsafeTimers.setInterval(() => functionRef(...args), delay);
|
return ThreadsafeTimers.setInterval(() => functionRef(...args), delay);
|
||||||
};
|
};
|
||||||
globalThis.clearInterval = ThreadsafeTimers.clearInterval;
|
globalThis.clearInterval = ThreadsafeTimers.clearInterval;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user