You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Address review comments
Improve comments and naming.
This commit is contained in:
@@ -15,12 +15,12 @@ var RoomState = require("./room-state");
|
||||
* 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, we
|
||||
* track 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>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, we link them together into a
|
||||
* <p>Once a timeline joins up with its neighbour, they are linked together into a
|
||||
* doubly-linked list.
|
||||
*
|
||||
* @param {string} roomId the ID of the room where this timeline came from
|
||||
@@ -45,8 +45,9 @@ function EventTimeline(roomId) {
|
||||
*
|
||||
* <p>This can only be called before any events are added.
|
||||
*
|
||||
* @param {MatrixEvent[]} stateEvents list of state events to intialise the
|
||||
* @param {MatrixEvent[]} stateEvents list of state events to initialise the
|
||||
* state with.
|
||||
* @throws {Error} if an attempt is made to call this after addEvent is called.
|
||||
*/
|
||||
EventTimeline.prototype.initialiseState = function(stateEvents) {
|
||||
if (this._events.length > 0) {
|
||||
@@ -67,7 +68,11 @@ EventTimeline.prototype.getRoomId = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the base index
|
||||
* Get the base index.
|
||||
*
|
||||
* <p>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.
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
@@ -137,6 +142,9 @@ EventTimeline.prototype.getNeighbouringTimeline = function(before) {
|
||||
*
|
||||
* @param {boolean} before true to set the previous timeline; false to set
|
||||
* following one.
|
||||
*
|
||||
* @throws {Error} if an attempt is made to set the neighbouring timeline when
|
||||
* it is already set.
|
||||
*/
|
||||
EventTimeline.prototype.setNeighbouringTimeline = function(neighbour, before) {
|
||||
if (this.getNeighbouringTimeline(before)) {
|
||||
|
||||
Reference in New Issue
Block a user