src/models/event-timeline.js
function EventTimeline(eventTimelineSet) {
    this._eventTimelineSet = eventTimelineSet;
    this._roomId = eventTimelineSet.room ? eventTimelineSet.room.roomId : null;
    this._events = [];
    this._baseIndex = 0;
    this._startState = new RoomState(this._roomId);
    this._startState.paginationToken = null;
    this._endState = new RoomState(this._roomId);
    this._endState.paginationToken = null;

    this._prevTimeline = null;
    this._nextTimeline = null;

    // this is used by client.js
    this._paginationRequests = {'b': null, 'f': null};

    this._name = this._roomId + ":" + new Date().toISOString();
}
function EventTimeline(eventTimelineSet) {
    this._eventTimelineSet = eventTimelineSet;
    this._roomId = eventTimelineSet.room ? eventTimelineSet.room.roomId : null;
    this._events = [];
    this._baseIndex = 0;
    this._startState = new RoomState(this._roomId);
    this._startState.paginationToken = null;
    this._endState = new RoomState(this._roomId);
    this._endState.paginationToken = null;

    this._prevTimeline = null;
    this._nextTimeline = null;

    // this is used by client.js
    this._paginationRequests = {'b': null, 'f': null};

    this._name = this._roomId + ":" + new Date().toISOString();
}
function EventTimeline ( eventTimelineSet ) { this . _eventTimelineSet = eventTimelineSet ; this . _roomId = eventTimelineSet . room ? eventTimelineSet . room . roomId : null ; this . _events = [ ] ; this . _baseIndex = 0 ; this . _startState = new RoomState ( this . _roomId ) ; this . _startState . paginationToken = null ; this . _endState = new RoomState ( this . _roomId ) ; this . _endState . paginationToken = null ; this . _prevTimeline = null ; this . _nextTimeline = null ; // this is used by client.js this . _paginationRequests = { 'b' : null , 'f' : null } ; this . _name = this . _roomId + ":" + new Date ( ) . toISOString ( ) ; }
Construct a new EventTimeline

<p>An EventTimeline represents a contiguous sequence of events in a room.

<p>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.

<p>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.

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

@param {EventTimelineSet} eventTimelineSet the set of timelines this is part of
@constructor
Construct a new EventTimeline