Closed adamritter closed 1 year ago
The more I'm thinking about implementing this function, the more questions pop up for the right semantic.
The right way to look at kind 0 / 3 events is one that has one value that can be updated, which is represented as a reader store with always the newest value (and starting with undefined), and there's no new function that can help in that Svelte reader store abstraction.
Probably what can be safely added to the API is a
getEventById(id: string, delayms?: number, options?: {noCache: boolean}) : Promise<Event>
Implementing subscription merging, delaying and caching gives us an amazing abstraction that can be used from the components without extra logic for managing data: getting one event. After implementing the other features this function is trivial to implement and joy to work with.