MapComplete/Logic/FeatureSource/Actors/RegisteringAllFromFeatureSourceActor.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
715 B
TypeScript
Raw Normal View History

import FeatureSource from "../FeatureSource";
import { Store } from "../../UIEventSource";
import { ElementStorage } from "../../ElementStorage";
import { Feature } from "geojson";
2021-04-18 14:24:30 +02:00
/**
* Makes sure that every feature is added to the ElementsStorage, so that the tags-eventsource can be retrieved
*/
export default class RegisteringAllFromFeatureSourceActor {
public readonly features: Store<Feature[]>
constructor(source: FeatureSource, allElements: ElementStorage) {
2021-04-18 14:24:30 +02:00
this.features = source.features
2021-06-30 16:02:46 +02:00
this.features.addCallbackAndRunD((features) => {
for (const feature of features) {
allElements.addOrGetElement(<any> feature)
2021-04-18 14:24:30 +02:00
}
})
}
}