I'm not quite sure I understand the question... And are you doing this on Bangle.js 1 or 2?
You can use setWatch(function() { ....}, BTN) to call something when a button is pressed, which may help. But if you're actually in a menu (especially on new Bangle.js) then the best bet is to create your own Bangle.setUI function, detect if it's given a 'back' argument, and add your own handler - then it'll work for everything.
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.
I'm not quite sure I understand the question... And are you doing this on Bangle.js 1 or 2?
You can use
setWatch(function() { ....}, BTN)
to call something when a button is pressed, which may help. But if you're actually in a menu (especially on new Bangle.js) then the best bet is to create your ownBangle.setUI
function, detect if it's given a 'back' argument, and add your own handler - then it'll work for everything.