From cb310d8f4ea460db917bfbc63f3763eca8b182bd Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Thu, 30 Nov 2023 12:32:06 +0100 Subject: [PATCH] Updated the pause.js controller --- server/controller/pause.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/server/controller/pause.js b/server/controller/pause.js index 54a22b9e..4d7dc353 100644 --- a/server/controller/pause.js +++ b/server/controller/pause.js @@ -1,20 +1,18 @@ let currentState = false; let updateTimer; -// Update the current state directly -module.exports.updateState = function(newState) { +module.exports.updateState = (newState) => { this.currentState = newState; } -// Update the current state in a specific time -module.exports.resumeIn = function(time) { - if (isNaN(time)) return; +module.exports.resumeIn = (hours) => { + if (isNaN(hours)) return; if (updateTimer !== null) clearTimeout(updateTimer); this.updateState(true); - updateTimer = setTimeout(() => this.updateState(false), time * 3600000); // time in hours + updateTimer = setTimeout(() => this.updateState(false), hours * 3600000); // time in hours return true; }