mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-22 19:49:31 -07:00
expose more data for scroll messages
This commit is contained in:
@@ -231,7 +231,7 @@ class CurrentWeather extends WeatherDisplay {
|
|||||||
this.setAutoReload();
|
this.setAutoReload();
|
||||||
if (stillWaiting) this.stillWaitingCallbacks.push(stillWaiting);
|
if (stillWaiting) this.stillWaitingCallbacks.push(stillWaiting);
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
if (this.data) resolve(this.data);
|
if (this.data) resolve({ data: this.data, parameters: this.weatherParameters });
|
||||||
// data not available, put it into the data callback queue
|
// data not available, put it into the data callback queue
|
||||||
this.getDataCallbacks.push(() => resolve(this.data));
|
this.getDataCallbacks.push(() => resolve(this.data));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ const incrementInterval = (force) => {
|
|||||||
|
|
||||||
const drawScreen = async () => {
|
const drawScreen = async () => {
|
||||||
// get the conditions
|
// get the conditions
|
||||||
const data = await getCurrentWeather();
|
const { data, parameters } = await getCurrentWeather();
|
||||||
|
|
||||||
// create a data object (empty if no valid current weather conditions)
|
// create a data object (empty if no valid current weather conditions)
|
||||||
const scrollData = data || {};
|
const scrollData = data || {};
|
||||||
@@ -100,7 +100,7 @@ const drawScreen = async () => {
|
|||||||
// if we have no current weather and no hazards, there's nothing to display
|
// if we have no current weather and no hazards, there's nothing to display
|
||||||
if (!data && (!scrollData.hazards || scrollData.hazards.length === 0)) return;
|
if (!data && (!scrollData.hazards || scrollData.hazards.length === 0)) return;
|
||||||
|
|
||||||
const thisScreen = workingScreens[screenIndex](scrollData);
|
const thisScreen = workingScreens[screenIndex](scrollData, parameters);
|
||||||
|
|
||||||
// update classes on the scroll area
|
// update classes on the scroll area
|
||||||
mainScroll.classList.forEach((cls) => { if (cls !== 'scroll') mainScroll.classList.remove(cls); });
|
mainScroll.classList.forEach((cls) => { if (cls !== 'scroll') mainScroll.classList.remove(cls); });
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ const getWeather = async (latLon, haveDataCallback) => {
|
|||||||
weatherParameters.forecast = point.properties.forecast;
|
weatherParameters.forecast = point.properties.forecast;
|
||||||
weatherParameters.forecastGridData = point.properties.forecastGridData;
|
weatherParameters.forecastGridData = point.properties.forecastGridData;
|
||||||
weatherParameters.stations = stations.features;
|
weatherParameters.stations = stations.features;
|
||||||
|
weatherParameters.relativeLocation = point.properties.relativeLocation.properties;
|
||||||
|
|
||||||
// update the main process for display purposes
|
// update the main process for display purposes
|
||||||
populateWeatherParameters(weatherParameters, point.properties);
|
populateWeatherParameters(weatherParameters, point.properties);
|
||||||
|
|||||||
Reference in New Issue
Block a user