mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-01-07 21:49:48 -06:00
Updated the pause.js controller
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user