More refactoring of the featuresources, cleanup, small changes

This commit is contained in:
Pieter Vander Vennet 2021-09-21 01:47:58 +02:00
parent d144f70ffb
commit c11ff652b8
7 changed files with 121 additions and 79 deletions

View file

@ -0,0 +1,20 @@
import FeatureSource from "../FeatureSource";
import {UIEventSource} from "../../UIEventSource";
/**
* A simple dummy implementation for whenever it is needed
*/
export default class StaticFeatureSource implements FeatureSource {
public readonly features: UIEventSource<{ feature: any; freshness: Date }[]>;
public readonly name: string = "StaticFeatureSource"
constructor(features: any[]) {
const now = new Date();
this.features = new UIEventSource(features.map(f => ({
feature: f,
freshness: now
})))
}
}