Class: EventContext

models/event-context~EventContext

new EventContext(ourEvent)

Construct a new EventContext An eventcontext is used for circumstances such as search results, when we have a particular event of interest, and a bunch of events before and after it. It also stores pagination tokens for going backwards and forwards in the timeline.
Parameters:
Name Type Description
ourEvent MatrixEvent the event at the centre of this context
Source:

Methods

addEvents(events, atStart)

Add more events to the timeline
Parameters:
Name Type Description
events Array new events, in timeline order
atStart boolean true to insert new events at the start
Source:

getEvent() → {MatrixEvent}

Get the main event of interest This is a convenience function for getTimeline()[getOurEventIndex()].
Source:
Returns:
The event at the centre of this context.
Type
MatrixEvent

getOurEventIndex() → {Number}

Get the index in the timeline of our event
Source:
Returns:
Type
Number

getPaginateToken(backwards) → {string}

Get a pagination token.
Parameters:
Name Type Description
backwards boolean true to get the pagination token for going backwards in time
Source:
Returns:
Type
string

getTimeline() → {Array}

Get the list of events in this context
Source:
Returns:
An array of MatrixEvents
Type
Array

setPaginateToken(token, backwards)

Set a pagination token. Generally this will be used only by the matrix js sdk.
Parameters:
Name Type Description
token string pagination token
backwards boolean true to set the pagination token for going backwards in time
Source: