Internal Class. SlidingList represents a single list in sliding sync. The list can have filters, multiple sliding windows, and maintains the index->room_id mapping.

Constructors

Properties

joinedCount: number = 0
roomIndexToRoomId: Record<number, string> = {}

Methods

  • Return a copy of the list suitable for a request body.

    Parameters

    • forceIncludeAllParams: boolean

      True to forcibly include all params even if the list hasn't been modified. Callers may want to do this if they are modifying the list prior to calling updateList.

    Returns MSC3575List

  • Check if a given index is within the list range. This is required even though the /sync API provides explicit updates with index positions because of the following situation: 0 1 2 3 4 5 6 7 8 indexes a b c d e f COMMANDS: SYNC 0 2 a b c; SYNC 6 8 d e f; a b c d _ f COMMAND: DELETE 7; e a b c d f COMMAND: INSERT 0 e; c=3 is wrong as we are not tracking it, ergo we need to see if i is in range else drop it

    Parameters

    • i: number

      The index to check

    Returns boolean

    True if the index is within a sliding window

  • Replace list parameters. All fields will be replaced with the new list parameters.

    Parameters

    Returns void

  • Mark this list as modified or not. Modified lists will return sticky params with calls to getList. This is useful for the first time the list is sent, or if the list has changed in some way.

    Parameters

    • modified: boolean

      True to mark this list as modified so all sticky parameters will be re-sent.

    Returns void

  • Update the list range for this list. Does not affect modified status as list ranges are non-sticky.

    Parameters

    • newRanges: number[][]

      The new ranges for the list

    Returns void