2021-09-21 02:10:42 +02:00
|
|
|
import FeatureSource from "../FeatureSource";
|
2022-06-05 02:24:14 +02:00
|
|
|
import {Store} from "../../UIEventSource";
|
2021-12-05 05:20:33 +01:00
|
|
|
import {ElementStorage} from "../../ElementStorage";
|
2021-04-18 14:24:30 +02:00
|
|
|
|
2022-01-15 02:44:11 +01:00
|
|
|
/**
|
|
|
|
* Makes sure that every feature is added to the ElementsStorage, so that the tags-eventsource can be retrieved
|
|
|
|
*/
|
2021-09-20 17:14:55 +02:00
|
|
|
export default class RegisteringAllFromFeatureSourceActor {
|
2022-06-05 02:24:14 +02:00
|
|
|
public readonly features: Store<{ feature: any; freshness: Date }[]>;
|
2021-05-10 23:51:03 +02:00
|
|
|
public readonly name;
|
|
|
|
|
2021-12-05 05:20:33 +01:00
|
|
|
constructor(source: FeatureSource, allElements: ElementStorage) {
|
2021-04-18 14:24:30 +02:00
|
|
|
this.features = source.features;
|
2021-05-10 23:51:03 +02:00
|
|
|
this.name = "RegisteringSource of " + source.name;
|
2021-06-30 16:02:46 +02:00
|
|
|
this.features.addCallbackAndRunD(features => {
|
|
|
|
for (const feature of features) {
|
2021-12-05 05:20:33 +01:00
|
|
|
allElements.addOrGetElement(feature.feature)
|
2021-04-18 14:24:30 +02:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|