Bangle.setUI({
mode : "custom",
back : function() {}, // optional - add a 'back' icon in top-left widget area and call this function when it is pressed , also call it when the hardware button is clicked (does not override btn if defined)
remove : function() {}, // optional - add a handler for when the UI should be removed (eg stop any intervals/timers here)
redraw : function() {}, // optional - add a handler to redraw the UI. Not needed but it can allow widgets/etc to provide other functionality that requires the screen to be redrawn
touch : function(n,e) {}, // optional - (mode:custom only) handler for 'touch' events
swipe : function(dir) {}, // optional - (mode:custom only) handler for 'swipe' events
drag : function(e) {}, // optional - (mode:custom only) handler for 'drag' events (Bangle.js 2 only)
btn : function(n) {}, // optional - (mode:custom only) handler for 'button' events (n==1 on Bangle.js 2, n==1/2/3 depending on button for Bangle.js 1)
clock : 0 // optional - if set the behavior of 'clock' mode is added (does not override btn if defined)
});
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.
more info to read:
https://www.espruino.com/ReferenceBANGLEJS2#l_Bangle_isLocked
Bangle.setUI({
mode : "custom",
back : function() {}, // optional - add a 'back' icon in top-left widget area and call this function when it is pressed , also call it when the hardware button is clicked (does not override btn if defined)
remove : function() {}, // optional - add a handler for when the UI should be removed (eg stop any intervals/timers here)
redraw : function() {}, // optional - add a handler to redraw the UI. Not needed but it can allow widgets/etc to provide other functionality that requires the screen to be redrawn
touch : function(n,e) {}, // optional - (mode:custom only) handler for 'touch' events
swipe : function(dir) {}, // optional - (mode:custom only) handler for 'swipe' events
drag : function(e) {}, // optional - (mode:custom only) handler for 'drag' events (Bangle.js 2 only)
btn : function(n) {}, // optional - (mode:custom only) handler for 'button' events (n==1 on Bangle.js 2, n==1/2/3 depending on button for Bangle.js 1)
clock : 0 // optional - if set the behavior of 'clock' mode is added (does not override btn if defined)
});