Merge pull request #3491 from thyttan/setui-proposal-preview

setuichange: fix push to undefined btnWatches array

as per https://forum.espruino.com/comments/17443678/
master
thyttan 2024-07-04 18:05:50 +02:00 committed by GitHub
commit a08436b92c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 1 deletions

View File

@ -1 +1,3 @@
0.01: New App!
0.02: Fix case where we tried to push to Bangle.btnWatches but it wasn't
defined.

View File

@ -103,6 +103,7 @@ Bangle.setUI = (function(mode, cb) {
Bangle.swipeHandler = options.swipe;
Bangle.on("swipe", Bangle.swipeHandler);
}
if ((options.btn || options.btnRelease) && !Bangle.btnWatches) Bangle.btnWatches = [];
if (options.btn) Bangle.btnWatches.push(setWatch(options.btn.bind(options), BTN1, {repeat:1,edge:"rising"}))
if (options.btnRelease) Bangle.btnWatches.push(setWatch(options.btnRelease.bind(options), BTN1, {repeat:1,edge:"falling"}))
if (options.remove) // handler for removing the UI (intervals/etc)

View File

@ -1,6 +1,6 @@
{ "id": "setuichange",
"name": "SetUI Proposals preview",
"version":"0.01",
"version":"0.02",
"description": "Try out potential future changes to `Bangle.setUI`. Makes hardware button interaction snappier. Makes it possible to set custom event handlers on any type/mode, not just `\"custom\"`. Please provide feedback - see `Read more...` below.",
"icon": "app.png",
"tags": "",