BangleApps/apps/drained/boot.js

14 lines
711 B
JavaScript
Raw Normal View History

2023-05-10 22:23:28 +00:00
(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;
2023-05-10 22:23:28 +00:00
if (E.getBattery() > threshold)
return;
2023-04-19 17:14:41 +00:00
var app = "drained.app.js";
2023-05-10 22:23:28 +00:00
if (!keepStartup)
2023-04-19 17:14:41 +00:00
require("Storage").write(".boot0", "if(typeof __FILE__ === \"undefined\" || __FILE__ !== \"".concat(app, "\") setTimeout(load, 100, \"").concat(app, "\");"));
load(app);
}, interval * 60 * 1000);
2023-05-10 22:23:28 +00:00
})();