mirror of https://github.com/espruino/BangleApps
edgeclk: refactor step event handling
Only register event handler if we want to actually use the event.pull/3582/head
parent
7a47e33441
commit
e8e24574b7
|
@ -281,10 +281,9 @@
|
|||
};
|
||||
|
||||
const onStep = function () {
|
||||
if (settings.redrawOnStep) drawSteps();
|
||||
drawSteps();
|
||||
}
|
||||
|
||||
|
||||
/* Lifecycle Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
|
@ -305,7 +304,7 @@
|
|||
Bangle.on('charging', onCharging);
|
||||
|
||||
// Continously update step count when they happen:
|
||||
Bangle.on('step', onStep);
|
||||
if (settings.redrawOnStep) Bangle.on('step', onStep);
|
||||
};
|
||||
|
||||
const deregisterEvents = function () {
|
||||
|
@ -314,7 +313,7 @@
|
|||
Bangle.removeListener('health', onHealth);
|
||||
Bangle.removeListener('lock', onLock);
|
||||
Bangle.removeListener('charging', onCharging);
|
||||
Bangle.removeListener('step', onStep);
|
||||
if (settings.redrawOnStep) Bangle.removeListener('step', onStep);
|
||||
};
|
||||
|
||||
const startTimers = function () {
|
||||
|
|
Loading…
Reference in New Issue