Skip to content

Commit

Permalink
E_showMenu_F18/Q3: rm internal l as cb func arg
Browse files Browse the repository at this point in the history
Remove internal menu object `l` as argument to callback function.

This removes a potential for memory leaks and should otherwise have no
impact. As no app on the main BangleApps repo seems to use the option.
See espruino#2567.

closes espruino#2567
  • Loading branch information
thyttan committed Oct 10, 2024
1 parent 133933b commit a49add7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
removeListener while executing events no longer stops subsequent listeners from executing (#2151)
jsvObjectIterator is now safe even if not called on something iterable
X.on now always allocates an array - tidies up code (fix #2559)
Bangle.js: E.showMenu no longer sends the internal `l` menu object as argument when running the callback function.

2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
Expand Down
4 changes: 2 additions & 2 deletions libs/js/banglejs/E_showMenu_F18.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
item.onchange(item.value);
l.draw(options.selected, options.selected);
}
} else if ("function" == typeof item) item(l);
} else if ("function" == typeof item) item();
else if ("object" == typeof item) {
// if a number, go into 'edit mode'
if ("number" == typeof item.value) {
Expand Down Expand Up @@ -198,4 +198,4 @@
};
l.draw();
return l;
})
})
2 changes: 1 addition & 1 deletion libs/js/banglejs/E_showMenu_F18.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libs/js/banglejs/E_showMenu_Q3.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
if (idx<0) return back&&back(); // title
var item = menu[keys[idx]];
Bangle.buzz(20);
if ("function" == typeof item) item(l);
if ("function" == typeof item) item();
else if ("object" == typeof item) {
// if a bool, just toggle it
if ("number" == typeof item.value) {
Expand Down
14 changes: 7 additions & 7 deletions libs/js/banglejs/E_showMenu_Q3.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a49add7

Please sign in to comment.