forked from MapComplete/MapComplete
Further work on infobox, styling everything, removing clutter
This commit is contained in:
parent
2acd53d150
commit
0b4016b65d
48 changed files with 1283 additions and 454 deletions
|
@ -8,7 +8,7 @@ export class UIEventSource<T>{
|
|||
}
|
||||
|
||||
|
||||
public addCallback(callback: (() => void)) {
|
||||
public addCallback(callback: ((latestData) => void)) {
|
||||
this._callbacks.push(callback);
|
||||
return this;
|
||||
}
|
||||
|
@ -23,18 +23,19 @@ export class UIEventSource<T>{
|
|||
|
||||
public ping(): void {
|
||||
for (let i in this._callbacks) {
|
||||
this._callbacks[i]();
|
||||
this._callbacks[i](this.data);
|
||||
}
|
||||
}
|
||||
|
||||
public map<J>(f: ((T) => J)): UIEventSource<J> {
|
||||
const newSource = new UIEventSource<J>(
|
||||
f(this.data)
|
||||
);
|
||||
const self = this;
|
||||
this.addCallback(function () {
|
||||
newSource.setData(f(self.data));
|
||||
newSource.ping();
|
||||
});
|
||||
const newSource = new UIEventSource<J>(
|
||||
f(this.data)
|
||||
);
|
||||
|
||||
return newSource;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue