mirror of https://github.com/espruino/BangleApps
sched: emit alarmReload, widalarm reload on alarmReload
parent
a25ed8f6ff
commit
0dd67533ac
|
@ -24,3 +24,4 @@
|
||||||
0.21: Fix crash in clock_info
|
0.21: Fix crash in clock_info
|
||||||
0.22: Dated event repeat option
|
0.22: Dated event repeat option
|
||||||
0.23: Allow buzzing forever when an alarm fires
|
0.23: Allow buzzing forever when an alarm fires
|
||||||
|
0.24: Emit alarmReload when alarms change (used by widalarm)
|
||||||
|
|
|
@ -55,10 +55,7 @@ exports.getTimeToAlarm = function(alarm, time) {
|
||||||
/// Force a reload of the current alarms and widget
|
/// Force a reload of the current alarms and widget
|
||||||
exports.reload = function() {
|
exports.reload = function() {
|
||||||
eval(require("Storage").read("sched.boot.js"));
|
eval(require("Storage").read("sched.boot.js"));
|
||||||
if (global.WIDGETS && WIDGETS["alarm"]) {
|
Bangle.emit("alarmReload");
|
||||||
WIDGETS["alarm"].reload();
|
|
||||||
Bangle.drawWidgets();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
// Factory that creates a new alarm with default values
|
// Factory that creates a new alarm with default values
|
||||||
exports.newDefaultAlarm = function () {
|
exports.newDefaultAlarm = function () {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "sched",
|
"id": "sched",
|
||||||
"name": "Scheduler",
|
"name": "Scheduler",
|
||||||
"version": "0.23",
|
"version": "0.24",
|
||||||
"description": "Scheduling library for alarms and timers",
|
"description": "Scheduling library for alarms and timers",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "scheduler",
|
"type": "scheduler",
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
0.01: Moved out of 'alarm' app
|
0.01: Moved out of 'alarm' app
|
||||||
|
0.02: Decouple reloading of widget when alarms change
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "widalarm",
|
"id": "widalarm",
|
||||||
"name": "Alarms Widget",
|
"name": "Alarms Widget",
|
||||||
"version": "0.01",
|
"version": "0.02",
|
||||||
"description": "Displays an alarm icon in the widgets bar if any alarm is active",
|
"description": "Displays an alarm icon in the widgets bar if any alarm is active",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"type": "widget",
|
"type": "widget",
|
||||||
|
|
|
@ -6,3 +6,9 @@ WIDGETS["alarm"]={area:"tl",width:0,draw:function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
WIDGETS["alarm"].reload();
|
WIDGETS["alarm"].reload();
|
||||||
|
Bangle.on("alarmReload", () => {
|
||||||
|
if (WIDGETS["alarm"]) {
|
||||||
|
WIDGETS["alarm"].reload();
|
||||||
|
Bangle.drawWidgets();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue