Construct a set of EventTimeline objects, typically on behalf of a given room. A room may have multiple EventTimelineSets for different levels of filtering. The global notification list is also an EventTimelineSet, but lacks a room.
This is an ordered sequence of timelines, which may or may not be continuous. Each timeline lists a series of events, as well as tracking the room state at the start and the end of the timeline (if appropriate). It also tracks forward and backward pagination tokens, as well as containing links to the next timeline in the sequence.
There is one special timeline - the 'live' timeline, which represents the timeline to which events are being added in real-time as they are received from the /sync API. Note that you should not retain references to this timeline - even if it is the current timeline right now, it may not remain so if the server gives us a timeline gap in /sync.
In order that we can find events from their ids later, we also maintain a map from event_id to timeline and index.
Room for this timelineSet. May be null for non-room cases, such as the notification timeline.
Options inherited from Room.
Optional
client: MatrixClientthe Matrix client which owns this EventTimelineSet, can be omitted if room is specified.
Optional
thread: Threadthe thread to which this timeline set relates.
Private
_eventPrivate
Readonly
displayPrivate
Optional
filterPrivate
liveReadonly
relationsReadonly
roomRoom for this timelineSet. May be null for non-room cases, such as the notification timeline.
Optional
Readonly
threadthe thread to which this timeline set relates.
Readonly
threadPrivate
Readonly
timelinePrivate
timelinesAdd event to the given timeline, and emit Room.timeline. Assumes we have already checked we don't know about this event.
Will fire "Room.timeline" for each event added.
Fires Timeline
In favor of the overload with IAddEventToTimelineOptions
Optional
fromCache: booleanOptional
roomState: RoomStateA list of events to add.
True to add these events to the start (oldest) instead of the end (newest) of the timeline. If true, the oldest event will be the last element of 'events'.
timeline to add events to.
Optional
paginationToken: null | stringtoken for the next batch of events
Add an event to the end of this live timeline.
Event to be added
addLiveEvent options
In favor of the overload with IAddLiveEventOptions
Optional
duplicateStrategy: DuplicateStrategyOptional
fromCache: booleanOptional
roomState: RoomStateAdd a new timeline to this timeline list
newly-created timeline
Determine whether a given event can sanely be added to this event timeline set,
for timeline sets relating to a thread, only return true for events in the same
thread timeline, for timeline sets not relating to a thread only return true
for events which should be shown in the main room timeline.
Requires the room
property to have been set at EventTimelineSet construction time.
Error if room
was not set when constructing this timeline set.
whether the event belongs to this timeline set.
the event to check whether it belongs to this timeline set.
Determine where two events appear in the timeline relative to one another
a number less than zero if eventId1 precedes eventId2, and greater than zero if eventId1 succeeds eventId2. zero if they are the same event; null if we can't tell (either because we don't know about one of the events, or because they are in separate timelines which don't join up).
The id of the first event
The id of the second event
Rest
...args: Parameters<EventTimelineSetHandlerMap[T]>Rest
...args: Parameters<EventTimelineSetHandlerMap[T]>Return the timeline (if any) this event is in.
timeline
the eventId being sought
Get an event which is stored in our timelines
the given event, or undefined if unknown
event ID to look for
Get the live timeline for this room.
live timeline
Get the list of pending sent events for this timelineSet's room, filtered by the timelineSet's filter if appropriate.
A list of the sent events waiting for remote echo.
If opts.pendingEventOrdering
was not 'detached'
Get the timeline which contains the given event, if any
timeline containing the given event, or null if unknown
Optional
eventId: stringevent ID to look for
Get all the timelines in this set
the timelines in this set
Replaces event with ID oldEventId with one with newEventId, if oldEventId is recognised. Otherwise, add to the live timeline. Used to handle remote echos.
Fires Timeline
the new event to be added to the timeline
the ID of the original event
the ID of the replacement event
Optional
event: EventEmitterEvents | EmittedEventsRemoves a single event from this room.
the removed event, or null if the event was not found in this room.
The id of the event to remove
Reset the live timeline, and start a new one.
This is used when /sync returns a 'limited' timeline.
Fires TimelineReset
Optional
backPaginationToken: stringtoken for back-paginating the new timeline
Optional
forwardPaginationToken: stringtoken for forward-paginating the old live timeline, if absent or null, all timelines are reset.
Set the live timeline for this room.
live timeline
Generated using TypeDoc
Typed Event Emitter class which can act as a Base Model for all our model and communication events. This makes it much easier for us to distinguish between events, as we now need to properly type this, so that our events are not stringly-based and prone to silly typos.