Fix hiding and showing of features

This commit is contained in:
Pieter Vander Vennet 2021-02-14 19:45:02 +01:00
parent d4f107c81a
commit bc1863dcb6
12 changed files with 160 additions and 137 deletions

View file

@ -77,7 +77,7 @@ export class UIEventSource<T> {
}
public setData(t: T): UIEventSource<T> {
if (this.data === t) {
if (this.data == t) { // MUST COMPARE BY REFERENCE!
return;
}
this.data = t;
@ -86,8 +86,12 @@ export class UIEventSource<T> {
}
public ping(): void {
const old = this.data;
for (const callback of this._callbacks) {
callback(this.data);
if(this.data === undefined && old !== undefined){
throw "Something undefined the data!"
}
}
}