Add presets to custom theme generator, fix simpleAddUI

This commit is contained in:
Pieter Vander Vennet 2020-09-03 03:16:43 +02:00
parent 9a420efa98
commit 3d05999f85
10 changed files with 90 additions and 36 deletions

View file

@ -8,11 +8,16 @@ export class UIEventSource<T>{
}
public addCallback(callback: ((latestData : T) => void)) : UIEventSource<T>{
public addCallback(callback: ((latestData: T) => void)): UIEventSource<T> {
this._callbacks.push(callback);
return this;
}
public addCallbackAndRun(callback: ((latestData: T) => void)): UIEventSource<T> {
callback(this.data);
return this.addCallback(callback);
}
public setData(t: T): UIEventSource<T> {
if (this.data === t) {
return;
@ -68,9 +73,7 @@ export class UIEventSource<T>{
})
}
return newSource;
}