TimelineBase

abstract class TimelineBase<T>(val onStateChange: suspend (TimelineStateChange<T>) -> Unit, val transformer: suspend (Flow<TimelineEvent>) -> T) : Timeline<T>

An implementation for some restrictions required by Timeline.

Implementing this may be useful for tests (e.g. a TimelineMock).

Inheritors

Constructors

Link copied to clipboard
constructor(onStateChange: suspend (TimelineStateChange<T>) -> Unit, transformer: suspend (Flow<TimelineEvent>) -> T)

Properties

Link copied to clipboard
Link copied to clipboard
open override val state: Flow<TimelineState<T>>

The current state of the timeline.

Link copied to clipboard
val transformer: suspend (Flow<TimelineEvent>) -> T

Functions

Link copied to clipboard
open suspend override fun dropAfter(roomId: RoomId, eventId: EventId): TimelineStateChange<T>

Drop all events after a given eventId.

Link copied to clipboard
open suspend override fun dropBefore(roomId: RoomId, eventId: EventId): TimelineStateChange<T>

Drop all events before a given eventId.

Link copied to clipboard
open suspend override fun init(roomId: RoomId, startFrom: EventId, configStart: GetTimelineEventConfig.() -> Unit, configBefore: GetTimelineEventsConfig.() -> Unit, configAfter: GetTimelineEventsConfig.() -> Unit): TimelineStateChange<T>

Initialize the timeline with the start event.

Link copied to clipboard
open suspend override fun loadAfter(config: GetTimelineEventsConfig.() -> Unit): TimelineStateChange<T>

Load new events after the newest event. With default config this may suspend until at least one event can be loaded.

Link copied to clipboard
open suspend override fun loadBefore(config: GetTimelineEventsConfig.() -> Unit): TimelineStateChange<T>

Load new events before the oldest event. With default config this may suspend until at least one event can be loaded.