Files
MagicMirror/js/module_functions.js
T

19 lines
527 B
JavaScript
Raw Normal View History

/**
* Schedule the timer for the next update
* @param {object} timer The timer of the module
* @param {bigint} intervalMS interval in milliseconds
2025-09-23 06:27:29 +02:00
* @param {Promise} callback function to call when the timer expires
*/
const scheduleTimer = function (timer, intervalMS, callback) {
2025-11-03 19:47:01 +01:00
if (process.env.mmTestMode !== "true") {
// only set timer when not running in test mode
let tmr = timer;
clearTimeout(tmr);
tmr = setTimeout(function () {
callback();
}, intervalMS);
}
};
module.exports = { scheduleTimer };