mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-14 07:39:29 -07:00
cache-busting for radar worker
This commit is contained in:
@@ -92,7 +92,7 @@ const updateStatus = (value) => {
|
||||
if (displays[0].status === STATUS.loading) return;
|
||||
|
||||
// calculate first enabled display
|
||||
const firstDisplayIndex = displays.findIndex((display) => display.enabled && display.timing.totalScreens > 0);
|
||||
const firstDisplayIndex = displays.findIndex((display) => display?.enabled && display?.timing?.totalScreens > 0);
|
||||
|
||||
// value.id = 0 is hazards, if they fail to load hot-wire a new value.id to the current display to see if it needs to be loaded
|
||||
// typically this plays out as current conditions loads, then hazards fails.
|
||||
|
||||
@@ -14,7 +14,7 @@ class Progress extends WeatherDisplay {
|
||||
|
||||
// setup event listener for dom-required initialization
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
this.version = document.querySelector('#version').innerHTML;
|
||||
this.version = document.querySelector('#version').innerHTML.replace(/\s/g, '');
|
||||
this.elem.querySelector('.container').addEventListener('click', this.lineClick.bind(this));
|
||||
});
|
||||
|
||||
@@ -91,3 +91,10 @@ class Progress extends WeatherDisplay {
|
||||
// register our own display
|
||||
const progress = new Progress(-1, 'progress');
|
||||
registerProgress(progress);
|
||||
|
||||
const version = () => progress.version;
|
||||
|
||||
export default progress;
|
||||
export {
|
||||
version,
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ import { text } from './utils/fetch.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
import { registerDisplay, timeZone } from './navigation.mjs';
|
||||
import * as utils from './radar-utils.mjs';
|
||||
import { version } from './progress.mjs';
|
||||
|
||||
// TEMPORARY fix to disable radar on ios safari. The same engine (webkit) is
|
||||
// used for all ios browers (chrome, brave, firefox, etc) so it's safe to skip
|
||||
@@ -196,7 +197,7 @@ class Radar extends WeatherDisplay {
|
||||
// create a radar worker with helper functions
|
||||
const radarWorker = () => {
|
||||
// create the worker
|
||||
const worker = new Worker(new URL('./radar-worker.mjs', import.meta.url), { type: 'module' });
|
||||
const worker = new Worker(`/resources/radar-worker.mjs?_=${version()}`, { type: 'module' });
|
||||
|
||||
const processRadar = (url) => new Promise((resolve, reject) => {
|
||||
// prepare for done message
|
||||
|
||||
Reference in New Issue
Block a user