diff --git a/apps/drained/boot.js b/apps/drained/boot.js index b71db0d92..48c1572bd 100644 --- a/apps/drained/boot.js +++ b/apps/drained/boot.js @@ -1,13 +1,13 @@ -{ - 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; +(function () { + 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 () { if (Bangle.isCharging()) return; - if (E.getBattery() > threshold_1) + if (E.getBattery() > threshold) return; 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, "\");")); load(app); }, interval * 60 * 1000); -} +})(); diff --git a/apps/drained/boot.ts b/apps/drained/boot.ts index 3675e06e6..1fcb0591b 100644 --- a/apps/drained/boot.ts +++ b/apps/drained/boot.ts @@ -1,4 +1,4 @@ -{ +(() => { const { battery: threshold = 5, interval = 10, keepStartup = true }: DrainedSettings = require("Storage").readJSON(`drained.setting.json`, true) || {}; @@ -18,4 +18,4 @@ drainedInterval = setInterval(() => { load(app); }, interval * 60 * 1000); -} +})()