drained: avoid polluting global scope
parent
1f6070bafd
commit
1cbda278fe
|
|
@ -1,13 +1,13 @@
|
||||||
{
|
(function () {
|
||||||
var _a = require("Storage").readJSON("drained.setting.json", true) || {}, _b = _a.battery, threshold_1 = _b === void 0 ? 5 : _b, _c = _a.interval, interval = _c === void 0 ? 10 : _c, _d = _a.keepStartup, keepStartup_1 = _d === void 0 ? true : _d;
|
var _a = require("Storage").readJSON("drained.setting.json", true) || {}, _b = _a.battery, threshold = _b === void 0 ? 5 : _b, _c = _a.interval, interval = _c === void 0 ? 10 : _c, _d = _a.keepStartup, keepStartup = _d === void 0 ? true : _d;
|
||||||
drainedInterval = setInterval(function () {
|
drainedInterval = setInterval(function () {
|
||||||
if (Bangle.isCharging())
|
if (Bangle.isCharging())
|
||||||
return;
|
return;
|
||||||
if (E.getBattery() > threshold_1)
|
if (E.getBattery() > threshold)
|
||||||
return;
|
return;
|
||||||
var app = "drained.app.js";
|
var app = "drained.app.js";
|
||||||
if (!keepStartup_1)
|
if (!keepStartup)
|
||||||
require("Storage").write(".boot0", "if(typeof __FILE__ === \"undefined\" || __FILE__ !== \"".concat(app, "\") setTimeout(load, 100, \"").concat(app, "\");"));
|
require("Storage").write(".boot0", "if(typeof __FILE__ === \"undefined\" || __FILE__ !== \"".concat(app, "\") setTimeout(load, 100, \"").concat(app, "\");"));
|
||||||
load(app);
|
load(app);
|
||||||
}, interval * 60 * 1000);
|
}, interval * 60 * 1000);
|
||||||
}
|
})();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{
|
(() => {
|
||||||
const { battery: threshold = 5, interval = 10, keepStartup = true }: DrainedSettings
|
const { battery: threshold = 5, interval = 10, keepStartup = true }: DrainedSettings
|
||||||
= require("Storage").readJSON(`drained.setting.json`, true) || {};
|
= require("Storage").readJSON(`drained.setting.json`, true) || {};
|
||||||
|
|
||||||
|
|
@ -18,4 +18,4 @@ drainedInterval = setInterval(() => {
|
||||||
|
|
||||||
load(app);
|
load(app);
|
||||||
}, interval * 60 * 1000);
|
}, interval * 60 * 1000);
|
||||||
}
|
})()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue