From 62659c0042dfd0d508e1adaa7a57e8a4170123d4 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Sun, 13 Nov 2022 17:04:33 +0100 Subject: [PATCH] swp2clk - Add swipe handler in timeout to prevent multiple execution --- apps/swp2clk/boot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/swp2clk/boot.js b/apps/swp2clk/boot.js index 194874fc3..accd40fec 100644 --- a/apps/swp2clk/boot.js +++ b/apps/swp2clk/boot.js @@ -122,8 +122,9 @@ if ((settings.mode === 1 && settings.whiteList.includes(fileName)) || // "White List" (settings.mode === 2 && !settings.blackList.includes(fileName)) || // "Black List" settings.mode === 3) { // "Always" - Bangle.on("swipe", swipeHandler); log("register swipe handler"); + // The handler must be added in the next idle time to prevent it executing directly iff Bangle.load was called in another swipe handler + setTimeout(()=>{Bangle.on("swipe", swipeHandler);},0); } } o(fileName);