But Bangle.CLOCK is only set if the clock uses Bangle.setUI(), so maybe your clock app doesn't use that?
If that's the case, I guess we should modify the widget to (also) check using __FILE__:
(()=>{
if (Bangle.CLOCK) {return;} // app used setUI('clock') or setUI('clockupdown')
// app didn't call Bangle.setUI('clock...'), but might still be a clock,
// look at <appid>.info to make sure
if (typeof __FILE__ === 'string') { // only exists since 2v09
const info = require("Storage").readJSON(__FILE__.split(".")[0]+".info",1)||false;
if (info && info.type==="clock") { // info can have no type (but then it isn't a clock)
return;
}
}
// current app is not a clock:
WIDGETS["wdclk"]={...};
})();
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It looks like the widget already tries not to run for clock apps: https://github.com/espruino/BangleApps/blob/d9d5926416566762e59b953c745f989d23c9b334/apps/widclk/widget.js#L6
But
Bangle.CLOCK
is only set if the clock usesBangle.setUI()
, so maybe your clock app doesn't use that?If that's the case, I guess we should modify the widget to (also) check using
__FILE__
: