mirror of https://github.com/espruino/BangleApps
exstats: permit "notify" handlers to change `.next`
parent
ca1cb2253a
commit
f581e15320
|
@ -158,8 +158,8 @@ Bangle.on("GPS", function(fix) {
|
||||||
if (stats["pacea"]) stats["pacea"].emit("changed",stats["pacea"]);
|
if (stats["pacea"]) stats["pacea"].emit("changed",stats["pacea"]);
|
||||||
if (stats["pacec"]) stats["pacec"].emit("changed",stats["pacec"]);
|
if (stats["pacec"]) stats["pacec"].emit("changed",stats["pacec"]);
|
||||||
if (state.notify.dist.increment > 0 && state.notify.dist.next <= state.distance) {
|
if (state.notify.dist.increment > 0 && state.notify.dist.next <= state.distance) {
|
||||||
stats["dist"].emit("notify",stats["dist"]);
|
|
||||||
state.notify.dist.next = state.notify.dist.next + state.notify.dist.increment;
|
state.notify.dist.next = state.notify.dist.next + state.notify.dist.increment;
|
||||||
|
stats["dist"].emit("notify",stats["dist"]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -169,8 +169,8 @@ Bangle.on("step", function(steps) {
|
||||||
state.stepHistory[0] += steps-state.lastSteps;
|
state.stepHistory[0] += steps-state.lastSteps;
|
||||||
state.lastSteps = steps;
|
state.lastSteps = steps;
|
||||||
if (state.notify.step.increment > 0 && state.notify.step.next <= steps) {
|
if (state.notify.step.increment > 0 && state.notify.step.next <= steps) {
|
||||||
stats["step"].emit("notify",stats["step"]);
|
|
||||||
state.notify.step.next = state.notify.step.next + state.notify.step.increment;
|
state.notify.step.next = state.notify.step.next + state.notify.step.increment;
|
||||||
|
stats["step"].emit("notify",stats["step"]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Bangle.on("HRM", function(h) {
|
Bangle.on("HRM", function(h) {
|
||||||
|
@ -336,8 +336,8 @@ exports.getStats = function(statIDs, options) {
|
||||||
if (stats["bpm"]) stats["bpm"].emit("changed",stats["bpm"]);
|
if (stats["bpm"]) stats["bpm"].emit("changed",stats["bpm"]);
|
||||||
}
|
}
|
||||||
if (state.notify.time.increment > 0 && state.notify.time.next <= now) {
|
if (state.notify.time.increment > 0 && state.notify.time.next <= now) {
|
||||||
stats["time"].emit("notify",stats["time"]);
|
|
||||||
state.notify.time.next = state.notify.time.next + state.notify.time.increment;
|
state.notify.time.next = state.notify.time.next + state.notify.time.increment;
|
||||||
|
stats["time"].emit("notify",stats["time"]);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
function reset() {
|
function reset() {
|
||||||
|
|
Loading…
Reference in New Issue