mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-01-08 14:09:50 -06:00
20 lines
450 B
JavaScript
20 lines
450 B
JavaScript
let currentState = false;
|
|
let updateTimer;
|
|
|
|
module.exports.updateState = (newState) => {
|
|
this.currentState = newState;
|
|
}
|
|
|
|
module.exports.resumeIn = (hours) => {
|
|
if (isNaN(hours)) return;
|
|
|
|
if (updateTimer !== null)
|
|
clearTimeout(updateTimer);
|
|
|
|
this.updateState(true);
|
|
updateTimer = setTimeout(() => this.updateState(false), hours * 3600000); // time in hours
|
|
|
|
return true;
|
|
}
|
|
|
|
module.exports.currentState = currentState; |