forked from MapComplete/MapComplete
Add presets to custom theme generator, fix simpleAddUI
This commit is contained in:
parent
9a420efa98
commit
3d05999f85
10 changed files with 90 additions and 36 deletions
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue