class static code cleanup

This commit is contained in:
Matt Walsh
2022-12-09 13:50:17 -06:00
parent 0c8db4f38e
commit 3f5cd4ca70
14 changed files with 631 additions and 629 deletions

View File

@@ -133,7 +133,7 @@ class Almanac extends WeatherDisplay {
fill.date = date;
fill.type = MoonPhase.phase;
fill.icon = { type: 'img', src: Almanac.imageName(MoonPhase.Phase) };
fill.icon = { type: 'img', src: imageName(MoonPhase.Phase) };
return this.fillTemplate('day', fill);
});
@@ -145,20 +145,6 @@ class Almanac extends WeatherDisplay {
this.finishDraw();
}
static imageName(type) {
switch (type) {
case 'Full':
return 'images/2/Full-Moon.gif';
case 'Last':
return 'images/2/Last-Quarter.gif';
case 'New':
return 'images/2/New-Moon.gif';
case 'First':
default:
return 'images/2/First-Quarter.gif';
}
}
// make sun and moon data available outside this class
// promise allows for data to be requested before it is available
async getSun() {
@@ -170,6 +156,20 @@ class Almanac extends WeatherDisplay {
}
}
const imageName = (type) => {
switch (type) {
case 'Full':
return 'images/2/Full-Moon.gif';
case 'Last':
return 'images/2/Last-Quarter.gif';
case 'New':
return 'images/2/New-Moon.gif';
case 'First':
default:
return 'images/2/First-Quarter.gif';
}
};
// register display
const display = new Almanac(8, 'almanac');
registerDisplay(display);