mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-18 09:39:30 -07:00
fix data sharing race condition
This commit is contained in:
@@ -20,6 +20,7 @@ class WeatherDisplay {
|
||||
this.data = undefined;
|
||||
this.loadingStatus = STATUS.loading;
|
||||
this.name = name?name:elemId;
|
||||
this.getDataCallbacks = [];
|
||||
|
||||
// default navigation timing
|
||||
this.timing = {
|
||||
@@ -126,6 +127,14 @@ class WeatherDisplay {
|
||||
return true;
|
||||
}
|
||||
|
||||
// return any data requested before it was available
|
||||
getDataCallback() {
|
||||
// call each callback
|
||||
this.getDataCallbacks.forEach(fxn => fxn(this.data));
|
||||
// clear the callbacks
|
||||
this.getDataCallbacks = [];
|
||||
}
|
||||
|
||||
drawCanvas() {
|
||||
// stop all gifs
|
||||
this.gifs.forEach(gif => gif.pause());
|
||||
|
||||
Reference in New Issue
Block a user