From b2ff2eb47f5b2ef6e3bc2c228e2a669f2930b1b9 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Tue, 3 Dec 2024 12:18:47 +0000 Subject: [PATCH] promenu: call `options.remove` when removed --- apps/promenu/ChangeLog | 1 + apps/promenu/bootb2.js | 2 ++ apps/promenu/bootb2.ts | 1 + apps/promenu/metadata.json | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/promenu/ChangeLog b/apps/promenu/ChangeLog index 1550736432..83140c994e 100644 --- a/apps/promenu/ChangeLog +++ b/apps/promenu/ChangeLog @@ -11,3 +11,4 @@ 0.07: Fix bug with alarms app (scroller) and correctly show images 0.08: Fix bug with modifying menu - allows hadash to save scroll positions 0.09: Don't show "..." if a string isn't truncated (i.e. scrolled) +0.10: Trigger `remove` callbacks when ending the menu diff --git a/apps/promenu/bootb2.js b/apps/promenu/bootb2.js index 48db76570f..1090229d20 100644 --- a/apps/promenu/bootb2.js +++ b/apps/promenu/bootb2.js @@ -193,9 +193,11 @@ E.showMenu = function (items) { mode: "updown", back: back, remove: function () { + var _a; if (nameScroller) clearInterval(nameScroller); Bangle.removeListener("swipe", onSwipe); + (_a = options.remove) === null || _a === void 0 ? void 0 : _a.call(options); }, }, function (dir) { if (dir) diff --git a/apps/promenu/bootb2.ts b/apps/promenu/bootb2.ts index ec285d959b..c284ad88b9 100644 --- a/apps/promenu/bootb2.ts +++ b/apps/promenu/bootb2.ts @@ -240,6 +240,7 @@ E.showMenu = (items?: Menu): MenuInstance => { remove: () => { if (nameScroller) clearInterval(nameScroller); Bangle.removeListener("swipe", onSwipe); + options.remove?.(); }, } as SetUIArg<"updown">, dir => { diff --git a/apps/promenu/metadata.json b/apps/promenu/metadata.json index cf9b3bcfff..87d9610456 100644 --- a/apps/promenu/metadata.json +++ b/apps/promenu/metadata.json @@ -1,7 +1,7 @@ { "id": "promenu", "name": "Pro Menu", - "version": "0.09", + "version": "0.10", "description": "Replace the built in menu function. Supports Bangle.js 1 and Bangle.js 2.", "icon": "icon.png", "type": "bootloader",