fix data sharing race condition
This commit is contained in:
parent
c4e8ef6a14
commit
98e01688ae
8 changed files with 285 additions and 8 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue