// base weather display class /* globals navigation, utils, draw, UNITS, luxon */ const STATUS = { loading: Symbol('loading'), loaded: Symbol('loaded'), failed: Symbol('failed'), noData: Symbol('noData'), }; // eslint-disable-next-line no-unused-vars class WeatherDisplay { constructor(navId, elemId, name) { // navId is used in messaging this.navId = navId; this.elemId = undefined; this.gifs = []; this.data = undefined; this.loadingStatus = STATUS.loading; this.name = name?name:elemId; // default navigation timing this.timing = { totalScreens: 1, baseDelay: 5000, // 5 seconds delay: 1, // 1*1second = 1 second total display time }; this.navBaseCount = 0; this.screenIndex = 0; this.setStatus(STATUS.loading); this.createCanvas(elemId); } // set data status and send update to navigation module setStatus(value) { this.status = value; navigation.updateStatus({ id: this.navId, status: this.status, }); } get status() { return this.loadingStatus; } set status(state) { this.loadingStatus = state; } createCanvas(elemId, width = 640, height = 480) { // only create it once if (this.elemId) return; this.elemId = elemId; const container = document.getElementById('container'); container.innerHTML += `