Pass dependencies explicitly, decrease dependency on legacy State.state

This commit is contained in:
Pieter Vander Vennet 2021-12-05 05:20:33 +01:00
parent 76c84b3972
commit 4f403c4bfc
4 changed files with 20 additions and 17 deletions

View file

@ -3,7 +3,6 @@ import {OsmNode, OsmRelation, OsmWay} from "../../Osm/OsmObject";
import FeatureSource from "../FeatureSource";
import {UIEventSource} from "../../UIEventSource";
import {ChangeDescription} from "../../Osm/Actions/ChangeDescription";
import State from "../../../State";
export class NewGeometryFromChangesFeatureSource implements FeatureSource {
// This class name truly puts the 'Java' into 'Javascript'
@ -14,7 +13,7 @@ export class NewGeometryFromChangesFeatureSource implements FeatureSource {
public readonly features: UIEventSource<{ feature: any; freshness: Date }[]> = new UIEventSource<{ feature: any; freshness: Date }[]>([]);
public readonly name: string = "newFeatures";
constructor(changes: Changes) {
constructor(changes: Changes, backendUrl: string) {
const seenChanges = new Set<ChangeDescription>();
const features = this.features.data;
@ -55,7 +54,7 @@ export class NewGeometryFromChangesFeatureSource implements FeatureSource {
}
tags["id"] = change.type + "/" + change.id
tags["_backend"] = State.state.osmConnection._oauth_config.url
tags["_backend"] = backendUrl
switch (change.type) {
case "node":