Skip to content

Commit e4d3124

Browse files
authored
Move Room properties JSDoc into more usable comments on actual props (#2067)
1 parent df11a9e commit e4d3124

File tree

1 file changed

+34
-20
lines changed

1 file changed

+34
-20
lines changed

src/models/room.ts

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,49 @@ export class Room extends EventEmitter {
136136
private membersPromise?: Promise<boolean>;
137137

138138
// XXX: These should be read-only
139+
/**
140+
* The human-readable display name for this room.
141+
*/
139142
public name: string;
143+
/**
144+
* The un-homoglyphed name for this room.
145+
*/
140146
public normalizedName: string;
147+
/**
148+
* Dict of room tags; the keys are the tag name and the values
149+
* are any metadata associated with the tag - e.g. { "fav" : { order: 1 } }
150+
*/
141151
public tags: Record<string, Record<string, any>> = {}; // $tagName: { $metadata: $value }
152+
/**
153+
* accountData Dict of per-room account_data events; the keys are the
154+
* event type and the values are the events.
155+
*/
142156
public accountData: Record<string, MatrixEvent> = {}; // $eventType: $event
157+
/**
158+
* The room summary.
159+
*/
143160
public summary: RoomSummary = null;
161+
/**
162+
* A token which a data store can use to remember the state of the room.
163+
*/
144164
public readonly storageToken?: string;
145165
// legacy fields
166+
/**
167+
* The live event timeline for this room, with the oldest event at index 0.
168+
* Present for backwards compatibility - prefer getLiveTimeline().getEvents()
169+
*/
146170
public timeline: MatrixEvent[];
171+
/**
172+
* oldState The state of the room at the time of the oldest
173+
* event in the live timeline. Present for backwards compatibility -
174+
* prefer getLiveTimeline().getState(EventTimeline.BACKWARDS).
175+
*/
147176
public oldState: RoomState;
177+
/**
178+
* currentState The state of the room at the time of the
179+
* newest event in the timeline. Present for backwards compatibility -
180+
* prefer getLiveTimeline().getState(EventTimeline.FORWARDS).
181+
*/
148182
public currentState: RoomState;
149183

150184
/**
@@ -192,26 +226,6 @@ export class Room extends EventEmitter {
192226
* Optional. Set to true to enable client-side aggregation of event relations
193227
* via `EventTimelineSet#getRelationsForEvent`.
194228
* This feature is currently unstable and the API may change without notice.
195-
*
196-
* @prop {string} roomId The ID of this room.
197-
* @prop {string} name The human-readable display name for this room.
198-
* @prop {string} normalizedName The un-homoglyphed name for this room.
199-
* @prop {Array<MatrixEvent>} timeline The live event timeline for this room,
200-
* with the oldest event at index 0. Present for backwards compatibility -
201-
* prefer getLiveTimeline().getEvents().
202-
* @prop {object} tags Dict of room tags; the keys are the tag name and the values
203-
* are any metadata associated with the tag - e.g. { "fav" : { order: 1 } }
204-
* @prop {object} accountData Dict of per-room account_data events; the keys are the
205-
* event type and the values are the events.
206-
* @prop {RoomState} oldState The state of the room at the time of the oldest
207-
* event in the live timeline. Present for backwards compatibility -
208-
* prefer getLiveTimeline().getState(EventTimeline.BACKWARDS).
209-
* @prop {RoomState} currentState The state of the room at the time of the
210-
* newest event in the timeline. Present for backwards compatibility -
211-
* prefer getLiveTimeline().getState(EventTimeline.FORWARDS).
212-
* @prop {RoomSummary} summary The room summary.
213-
* @prop {*} storageToken A token which a data store can use to remember
214-
* the state of the room.
215229
*/
216230
constructor(
217231
public readonly roomId: string,

0 commit comments

Comments
 (0)