Various bug fixes, add layer selection and background selection as parameter to the URL (fix #86, fix #84)

This commit is contained in:
Pieter Vander Vennet 2020-08-08 02:16:42 +02:00
parent e35c85fc55
commit 97a69ff903
14 changed files with 111 additions and 25 deletions

View file

@ -45,9 +45,14 @@ export class UIEventSource<T>{
}
public map<J>(f: ((T) => J),
extraSources: UIEventSource<any>[] = []): UIEventSource<J> {
extraSources: UIEventSource<any>[] = [],
g: ((J) => T) = undefined ): UIEventSource<J> {
const self = this;
const newSource = new UIEventSource<J>(
f(this.data)
);
const update = function () {
newSource.setData(f(self.data));
newSource.ping();
@ -57,9 +62,12 @@ export class UIEventSource<T>{
for (const extraSource of extraSources) {
extraSource.addCallback(update);
}
const newSource = new UIEventSource<J>(
f(this.data)
);
if(g !== undefined) {
newSource.addCallback((latest) => {
self.setData((g(latest)));
})
}
return newSource;