mirror of https://github.com/espruino/BangleApps
[widbt_notify] Prevent repeated `draw()`
Replace `setInterval` with `setTimeout` to clear the `Connection lost.`-message to prevent repeatedly calling of `draw()` from the current app/clock.pull/1844/head
parent
8102fd4e72
commit
dde4cc1562
|
@ -8,3 +8,4 @@
|
|||
0.09: Vibrate on connection loss
|
||||
0.10: Bug fix
|
||||
0.11: Avoid too many notifications. Change disconnected colour to red.
|
||||
0.12: Prevent repeated execution of `draw()` from the current app.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "widbt_notify",
|
||||
"name": "Bluetooth Widget with Notification",
|
||||
"version": "0.11",
|
||||
"version": "0.12",
|
||||
"description": "Show the current Bluetooth connection status in the top right of the clock and vibrate when disconnected.",
|
||||
"icon": "widget.png",
|
||||
"type": "widget",
|
||||
|
|
|
@ -28,7 +28,7 @@ WIDGETS.bluetooth_notify = {
|
|||
disconnect: function() {
|
||||
if(WIDGETS.bluetooth_notify.warningEnabled == 1){
|
||||
E.showMessage(/*LANG*/'Connection\nlost.', 'Bluetooth');
|
||||
setInterval(()=>{WIDGETS.bluetooth_notify.redrawCurrentApp();}, 3000); // clear message - this will reload the widget, resetting 'warningEnabled'.
|
||||
setTimeout(()=>{WIDGETS.bluetooth_notify.redrawCurrentApp();}, 3000); // clear message - this will reload the widget, resetting 'warningEnabled'.
|
||||
|
||||
WIDGETS.bluetooth_notify.warningEnabled = 0;
|
||||
setTimeout('WIDGETS.bluetooth_notify.warningEnabled = 1;', 30000); // don't buzz for the next 30 seconds.
|
||||
|
|
Loading…
Reference in New Issue