Class EventTimeline

Hierarchy

  • EventTimeline

Constructors

  • Construct a new EventTimeline

    An EventTimeline represents a contiguous sequence of events in a room.

    As well as keeping track of the events themselves, it stores the state of the room at the beginning and end of the timeline, and pagination tokens for going backwards and forwards in the timeline.

    In order that clients can meaningfully maintain an index into a timeline, the EventTimeline object tracks a 'baseIndex'. This starts at zero, but is incremented when events are prepended to the timeline. The index of an event relative to baseIndex therefore remains constant.

    Once a timeline joins up with its neighbour, they are linked together into a doubly-linked list.

    Parameters

    Returns EventTimeline

Properties

baseIndex: number = 0
endState?: RoomState
endToken: null | string = null
eventTimelineSet: EventTimelineSet

the set of timelines this is part of

events: MatrixEvent[] = []
name: string
nextTimeline: null | EventTimeline = null
paginationRequests: Record<Direction, null | Promise<boolean>> = ...
prevTimeline: null | EventTimeline = null
roomId: null | string
startState?: RoomState
startToken: null | string = null
BACKWARDS: Backward = Direction.Backward

Symbolic constant for methods which take a 'direction' argument: refers to the start of the timeline, or backwards in time.

FORWARDS: Forward = Direction.Forward

Symbolic constant for methods which take a 'direction' argument: refers to the end of the timeline, or forwards in time.

Methods

  • Creates an independent timeline, inheriting the directional state from this timeline.

    Returns

    the new timeline

    Parameters

    • direction: Direction

      EventTimeline.BACKWARDS to get the state at the start of the timeline; EventTimeline.FORWARDS to get the state at the end of the timeline.

    Returns EventTimeline

  • Forks the (live) timeline, taking ownership of the existing directional state of this timeline. All attached listeners will keep receiving state updates from the new live timeline state. The end state of this timeline gets replaced with an independent copy of the current RoomState, and will need a new pagination token if it ever needs to paginate forwards.

    Returns

    the new timeline

    Parameters

    • direction: Direction

      EventTimeline.BACKWARDS to get the state at the start of the timeline; EventTimeline.FORWARDS to get the state at the end of the timeline.

    Returns EventTimeline

  • Get the base index.

    This is an index which is incremented when events are prepended to the timeline. An individual event therefore stays at the same index in the array relative to the base index (although note that a given event's index may well be less than the base index, thus giving that event a negative relative index).

    Returns number

  • Get the next timeline in the series

    Returns

    previous or following timeline, if they have been joined up.

    Parameters

    • direction: Direction

      EventTimeline.BACKWARDS to get the previous timeline; EventTimeline.FORWARDS to get the next timeline.

    Returns null | EventTimeline

  • Get a pagination token

    Returns

    pagination token

    Parameters

    • direction: Direction

      EventTimeline.BACKWARDS to get the pagination token for going backwards in time; EventTimeline.FORWARDS to get the pagination token for going forwards in time.

    Returns null | string

  • Get the room state at the start/end of the timeline

    Returns

    state at the start/end of the timeline

    Parameters

    • direction: Direction

      EventTimeline.BACKWARDS to get the state at the start of the timeline; EventTimeline.FORWARDS to get the state at the end of the timeline.

    Returns undefined | RoomState

  • Set the next timeline in the series

    Throws

    Error if an attempt is made to set the neighbouring timeline when it is already set.

    Parameters

    • neighbour: EventTimeline

      previous/following timeline

    • direction: Direction

      EventTimeline.BACKWARDS to set the previous timeline; EventTimeline.FORWARDS to set the next timeline.

    Returns void

  • Set a pagination token

    Parameters

    • token: null | string

      pagination token

    • direction: Direction

      EventTimeline.BACKWARDS to set the pagination token for going backwards in time; EventTimeline.FORWARDS to set the pagination token for going forwards in time.

    Returns void

  • Return a string to identify this timeline, for debugging

    Returns

    name for this timeline

    Returns string

  • Static helper method to set sender and target properties

    Parameters

    • event: MatrixEvent

      the event whose metadata is to be set

    • stateContext: RoomState

      the room state to be queried

    • toStartOfTimeline: boolean

      if true the event's forwardLooking flag is set false

    Returns void

Generated using TypeDoc