1
0
Fork 0
BangleApps/apps/drained/boot.ts

21 lines
519 B
TypeScript
Raw Normal View History

2023-04-13 17:30:49 +00:00
const { battery: threshold = 5, interval = 10, disableBoot = false }: DrainedSettings
= require("Storage").readJSON(`drained.setting.json`, true) || {};
drainedInterval = setInterval(() => {
2023-03-10 23:20:28 +00:00
if(Bangle.isCharging())
return;
2023-04-13 17:30:49 +00:00
if(E.getBattery() > threshold)
2023-03-10 23:20:28 +00:00
return;
2023-04-13 17:30:49 +00:00
if(disableBoot){
require("Storage").erase(".boot0");
Bangle.on("charging", charging => {
if (charging)
eval(require('Storage').read('bootupdate.js'));
});
}
2023-04-07 16:52:54 +00:00
load("drained.app.js");
}, interval * 60 * 1000);