cleanup code and fix fastload issue
parent
35668fd853
commit
c6255ce9c8
|
|
@ -10,4 +10,5 @@
|
||||||
0.10: Tell clock widgets to hide.
|
0.10: Tell clock widgets to hide.
|
||||||
0.11: fix issue https://github.com/espruino/BangleApps/issues/2128 (#2128) ( settings undefined )
|
0.11: fix issue https://github.com/espruino/BangleApps/issues/2128 (#2128) ( settings undefined )
|
||||||
0.12: implemented widget_utils
|
0.12: implemented widget_utils
|
||||||
0.13: convert var/function into let
|
0.13: convert var/function into let
|
||||||
|
0.14: cleanup code and fix fastload issue
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "rebble",
|
"id": "rebble",
|
||||||
"name": "Rebble Clock",
|
"name": "Rebble Clock",
|
||||||
"shortName": "Rebble",
|
"shortName": "Rebble",
|
||||||
"version": "0.13",
|
"version": "0.14",
|
||||||
"description": "A Pebble style clock, with configurable background, three sidebars including steps, day, date, sunrise, sunset, long live the rebellion",
|
"description": "A Pebble style clock, with configurable background, three sidebars including steps, day, date, sunrise, sunset, long live the rebellion",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"icon": "rebble.png",
|
"icon": "rebble.png",
|
||||||
|
|
|
||||||
|
|
@ -291,48 +291,8 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
log_debug("starting..");
|
|
||||||
loadSettings();
|
|
||||||
loadLocation();
|
|
||||||
|
|
||||||
|
let chargingListener= function(charging) {
|
||||||
if(settings.autoCycle || settings.sideTap==0)
|
|
||||||
{
|
|
||||||
Bangle.setUI({
|
|
||||||
mode : "clockupdown",
|
|
||||||
remove : function() {
|
|
||||||
// Called to unload all of the clock app
|
|
||||||
if (drawTimeout) clearTimeout(drawTimeout);
|
|
||||||
drawTimeout = undefined;
|
|
||||||
delete Graphics.prototype.setFontKdamThmor;
|
|
||||||
}},
|
|
||||||
btn=> {
|
|
||||||
if (btn<0) prevSidebar();
|
|
||||||
if (btn>0) nextSidebar();
|
|
||||||
draw();
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Bangle.setUI({
|
|
||||||
mode : "clock",
|
|
||||||
remove : function() {
|
|
||||||
// Called to unload all of the clock app
|
|
||||||
if (drawTimeout) clearTimeout(drawTimeout);
|
|
||||||
drawTimeout = undefined;
|
|
||||||
delete Graphics.prototype.setFontKdamThmor;
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Bangle.loadWidgets();
|
|
||||||
draw();
|
|
||||||
require("widget_utils").hide();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bangle.on('charging', function(charging) {
|
|
||||||
|
|
||||||
//redraw the sidebar ( with the battery )
|
//redraw the sidebar ( with the battery )
|
||||||
switch(sideBar) {
|
switch(sideBar) {
|
||||||
|
|
@ -343,5 +303,55 @@ Graphics.prototype.setFontKdamThmor = function(scale) {
|
||||||
drawSideBar2();
|
drawSideBar2();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
let deleteAll=function()
|
||||||
|
{
|
||||||
|
// Called to unload all of the clock app
|
||||||
|
if (drawTimeout) clearTimeout(drawTimeout);
|
||||||
|
drawTimeout = undefined;
|
||||||
|
delete Graphics.prototype.setFontKdamThmor;
|
||||||
|
Bangle.removeListener('charging',chargingListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
let main=function(){
|
||||||
|
|
||||||
|
|
||||||
|
log_debug("starting..");
|
||||||
|
loadSettings();
|
||||||
|
loadLocation();
|
||||||
|
|
||||||
|
if(settings.autoCycle || settings.sideTap==0)
|
||||||
|
{
|
||||||
|
Bangle.setUI({
|
||||||
|
mode : "clockupdown",
|
||||||
|
remove : deleteAll
|
||||||
|
},
|
||||||
|
btn=> {
|
||||||
|
if (btn<0) prevSidebar();
|
||||||
|
if (btn>0) nextSidebar();
|
||||||
|
draw();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Bangle.setUI({
|
||||||
|
mode : "clock",
|
||||||
|
remove : deleteAll
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Bangle.on('charging',chargingListener);
|
||||||
|
|
||||||
|
|
||||||
|
Bangle.loadWidgets();
|
||||||
|
draw();
|
||||||
|
require("widget_utils").hide();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
main();
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue