netbymatt / ws4kp

WeatherStar 4000+
https://weatherstar.netbymatt.com
MIT License
273 stars 47 forks source link

Update data without page refresh? #13

Closed gtxaspec closed 2 years ago

gtxaspec commented 2 years ago

Is data updated as time goes by, or just on a page refresh? Or, is there a way to refresh data without "interruption"?

Opening an issue as I don't see a discussions area in the repo.

Thank You!

netbymatt commented 2 years ago

Data does refresh as time goes by. When not in full screen there's a countdown timer at the bottom of the page showing how long until the next refresh (10 minute interval). It does not reload the page, but it does cause the cycling of the weather slides to go back to the first one once the data is loaded.

Currently the jump-to-beginning behavior is a quick way to accomplish this without having to separate the back end data gathering from the display of data. There are two potential improvements to this:

  1. (easy) If the slideshow is playing, wait until the timer expires, and the loop finishes the last slide, then do a refresh.
  2. (complicated) Separate the data gathering and formatting from drawing the displays.

I can accomplish the first one in the near future. And I don't plan to make a changeable 10-minute limit. From my experience with the api, the data is only updated once per hour with the exact time of the update dependent on the weather office issuing the forecast and data. So 10 minutes is a reasonable compromise between up-to-date data and not hammering the API with requests.