Cleanup icon preload
This commit is contained in:
parent
77c0744cb3
commit
37eb88a90d
2
dist/index.html
vendored
2
dist/index.html
vendored
File diff suppressed because one or more lines are too long
2
dist/resources/ws.min.js
vendored
2
dist/resources/ws.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -21,9 +21,37 @@ class Almanac extends WeatherDisplay {
|
||||||
this.backgroundImage = utils.image.load('images/BackGround3_1.png');
|
this.backgroundImage = utils.image.load('images/BackGround3_1.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
getData(weatherParameters) {
|
async getData(weatherParameters) {
|
||||||
super.getData();
|
super.getData();
|
||||||
|
|
||||||
|
// get images for outlook
|
||||||
|
const imagePromises = [
|
||||||
|
utils.image.load('https://www.cpc.ncep.noaa.gov/products/predictions/30day/off14_temp.gif'),
|
||||||
|
utils.image.load('https://www.cpc.ncep.noaa.gov/products/predictions/30day/off14_prcp.gif'),
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// get sun/moon data
|
||||||
|
const {sun, moon} = this.calcSunMoonData(weatherParameters);
|
||||||
|
|
||||||
|
// process images for outlook
|
||||||
|
const [outlookTemp, outlookPrecip] = await Promise.all(imagePromises);
|
||||||
|
|
||||||
|
console.log(outlookTemp,outlookPrecip);
|
||||||
|
const outlook = 1;
|
||||||
|
|
||||||
|
// store the data
|
||||||
|
this.data = {
|
||||||
|
sun,
|
||||||
|
moon,
|
||||||
|
outlook,
|
||||||
|
};
|
||||||
|
// draw the canvas
|
||||||
|
this.drawCanvas();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
calcSunMoonData(weatherParameters) {
|
||||||
const {DateTime} = luxon;
|
const {DateTime} = luxon;
|
||||||
|
|
||||||
const sun = [
|
const sun = [
|
||||||
|
@ -53,14 +81,10 @@ class Almanac extends WeatherDisplay {
|
||||||
iterations++;
|
iterations++;
|
||||||
} while (iterations <= 30 && moon.length < 4);
|
} while (iterations <= 30 && moon.length < 4);
|
||||||
|
|
||||||
// store the data
|
return {
|
||||||
this.data = {
|
|
||||||
sun,
|
sun,
|
||||||
moon,
|
moon,
|
||||||
};
|
};
|
||||||
// draw the canvas
|
|
||||||
this.drawCanvas();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get moon transition from one phase to the next by drilling down by hours, minutes and seconds
|
// get moon transition from one phase to the next by drilling down by hours, minutes and seconds
|
||||||
|
|
|
@ -43,7 +43,7 @@ class CurrentWeather extends WeatherDisplay {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// preload the icon
|
// preload the icon
|
||||||
utils.image.preload(icons.getWeatherIconFromIconLink(observations.iconPath));
|
utils.image.preload(icons.getWeatherIconFromIconLink(observations.features[0].properties.icon));
|
||||||
|
|
||||||
// we only get here if there was no error above
|
// we only get here if there was no error above
|
||||||
this.data = Object.assign({}, observations, {station: station});
|
this.data = Object.assign({}, observations, {station: station});
|
||||||
|
@ -67,7 +67,7 @@ class CurrentWeather extends WeatherDisplay {
|
||||||
let WindChill = Math.round(observations.windChill.value);
|
let WindChill = Math.round(observations.windChill.value);
|
||||||
let WindGust = Math.round(observations.windGust.value);
|
let WindGust = Math.round(observations.windGust.value);
|
||||||
let Humidity = Math.round(observations.relativeHumidity.value);
|
let Humidity = Math.round(observations.relativeHumidity.value);
|
||||||
const Icon = icons.getWeatherIconFromIconLink(observations.iconPath);
|
const Icon = icons.getWeatherIconFromIconLink(observations.icon);
|
||||||
let PressureDirection = '';
|
let PressureDirection = '';
|
||||||
const TextConditions = observations.textDescription;
|
const TextConditions = observations.textDescription;
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
module.exports = '3.1.2';
|
module.exports = '3.1.3';
|
Loading…
Reference in a new issue