Add image delete button

This commit is contained in:
Pieter Vander Vennet 2020-07-08 11:23:36 +02:00
parent f548ddea84
commit 0fe6b67976
13 changed files with 303 additions and 54 deletions

View file

@ -27,15 +27,23 @@ export class UIEventSource<T>{
}
}
public map<J>(f: ((T) => J)): UIEventSource<J> {
public map<J>(f: ((T) => J),
extraSources : UIEventSource<any>[] = []): UIEventSource<J> {
const self = this;
this.addCallback(function () {
const update = function () {
newSource.setData(f(self.data));
newSource.ping();
});
}
this.addCallback(update);
for (const extraSource of extraSources) {
extraSource.addCallback(update);
}
const newSource = new UIEventSource<J>(
f(this.data)
);
return newSource;