-
|
I've been looking, and it doesn't seem like there's a way to check what app is currently open. That could be useful for many reasons, like a boot script doing something if a certain app is loaded and inactive, or other apps checking to see what's currently open. I would use this in an app I'm working on, which has an app that I would like to return to the clock if a trigger happens in the corresponding boot.js script, and there's currently no way for me to do that. We could achieve something similar by just tracking what gets loaded, and updates accordingly: global.appOpen=""
// if app is loaded, update global.appOpen
let Bangle.load=function(src){
// not the real Bangle.load function, just a demo
global.appOpen=src;
load(src)
}
// Apps can then use it like so:
if(global.appOpen="sleepsummarymsg.app.js"){
// return to clock
Bangle.load()
}I know something like this exists to see whether an app is the clock, but I would like this to be more extensive and track all apps. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
I think you'll want to use the |
Beta Was this translation helpful? Give feedback.
-
|
Oh wow! I didn't see that at all. Thanks! |
Beta Was this translation helpful? Give feedback.
I think you'll want to use the
global.__FILE__variable: https://www.espruino.com/ReferenceBANGLEJS2#l__global___FILE__