2022-09-08 21:40:48 +02:00
|
|
|
import FeatureSource from "../FeatureSource"
|
|
|
|
import { Store } from "../../UIEventSource"
|
|
|
|
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-09-08 21:40:48 +02:00
|
|
|
public readonly features: Store<{ feature: any; freshness: Date }[]>
|
|
|
|
public readonly name
|
2021-05-10 23:51:03 +02:00
|
|
|
|
2021-12-05 05:20:33 +01:00
|
|
|
constructor(source: FeatureSource, allElements: ElementStorage) {
|
2022-09-08 21:40:48 +02:00
|
|
|
this.features = source.features
|
|
|
|
this.name = "RegisteringSource of " + source.name
|
|
|
|
this.features.addCallbackAndRunD((features) => {
|
2021-06-30 16:02:46 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
2022-09-08 21:40:48 +02:00
|
|
|
}
|