From 4c5f121d2372d9219f3fbfa2055d7738b36f5f9a Mon Sep 17 00:00:00 2001 From: Florian Hotze Date: Fri, 16 Dec 2022 17:46:02 +0100 Subject: [PATCH] [helpers] Remove arg param from createTimer Switch from the deprecated `actions.ScriptExecution.createTimerWithArgument` to ...`createTimer` to the threadsafe version. Reference https://github.com/openhab/openhab-js/pull/171. --- helpers.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/helpers.js b/helpers.js index 755c139..a40c78a 100644 --- a/helpers.js +++ b/helpers.js @@ -7,12 +7,11 @@ const { actions, time } = require('openhab'); * * @param {*} when any representation of time or duration, see {@link https://openhab.github.io/openhab-js/time.html#.toZDT time.toZDT} * @param {function} func function to call when the timer expires - * @param {*} [arg] argument to pass to the timer * @param {string} [name] name for the timer * @param {string} [key] key of the timer to append to the generated name * @returns openHAB Java {@link https://www.openhab.org/javadoc/latest/org/openhab/core/model/script/actions/timer Timer} */ -const createTimer = (when, func, arg, name, key) => { +const createTimer = (when, func, name, key) => { const timeout = time.toZDT(when); if (name === null || name === undefined) { if (global.ruleUID !== undefined) { // Use UI ruleUID and key if available @@ -21,7 +20,7 @@ const createTimer = (when, func, arg, name, key) => { name = 'file.' + global['javax.script.filename'].replace(/^.*[\\/]/, '') + ((key !== undefined) ? '.' + key : ''); } } - return actions.ScriptExecution.createTimerWithArgument(name, timeout, arg, func); + return actions.ScriptExecution.createTimer(name, timeout, func); }; module.exports = {