You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-09-01 21:21:58 +03:00
Move event jsdoc to respective classes. Document which functions fire.
This tends to boil down into a setXEvent method which can fire if it updates the model.
This commit is contained in:
@@ -43,11 +43,13 @@ Room.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Add some events to this room's timeline.
|
||||
* Add some events to this room's timeline. Will fire "Room.timeline" for
|
||||
* each event added.
|
||||
* @param {MatrixEvent[]} events A list of events to add.
|
||||
* @param {boolean} toStartOfTimeline True to add these events to the start
|
||||
* (oldest) instead of the end (newest) of the timeline. If true, the oldest
|
||||
* event will be the <b>last</b> element of 'events'.
|
||||
* @fires module:client~MatrixClient#event:"Room.timeline"
|
||||
*/
|
||||
addEventsToTimeline: function(events, toStartOfTimeline) {
|
||||
for (var i = 0; i < events.length; i++) {
|
||||
@@ -85,7 +87,9 @@ Room.prototype = {
|
||||
/**
|
||||
* Recalculate various aspects of the room, including the room name and
|
||||
* room summary. Call this any time the room's current state is modified.
|
||||
* May fire "Room.name" if the room name is updated.
|
||||
* @param {string} userId The client's user ID.
|
||||
* @fires module:client~MatrixClient#event:"Room.name"
|
||||
*/
|
||||
recalculate: function(userId) {
|
||||
this.name = this.calculateRoomName(userId);
|
||||
@@ -153,3 +157,32 @@ Room.prototype = {
|
||||
* The Room class.
|
||||
*/
|
||||
module.exports = Room;
|
||||
|
||||
/**
|
||||
* Fires whenever the timeline in a room is updated.
|
||||
* @event module:client~MatrixClient#"Room.timeline"
|
||||
* @param {MatrixEvent} event The matrix event which caused this event to fire.
|
||||
* @param {Room} room The room whose Room.timeline was updated.
|
||||
* @param {boolean} toStartOfTimeline True if this event was added to the start
|
||||
* (beginning; oldest) of the timeline e.g. due to pagination.
|
||||
* @example
|
||||
* matrixClient.on("Room.timeline", function(event, room, toStartOfTimeline){
|
||||
* if (toStartOfTimeline) {
|
||||
* var messageToAppend = room.timeline[room.timeline.length - 1];
|
||||
* }
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires whenever the name of a room is updated.
|
||||
* @event module:client~MatrixClient#"Room.name"
|
||||
* @param {MatrixEvent} event The matrix event which caused this event to fire.
|
||||
* This will not always be <code>m.room.name</code>, as sometimes
|
||||
* <code>m.room.aliases</code> or <code>m.room.member</code> events cause the
|
||||
* Room.name to be updated.
|
||||
* @param {Room} room The room whose Room.name was updated.
|
||||
* @example
|
||||
* matrixClient.on("Room.name", function(event, room){
|
||||
* var newName = room.name;
|
||||
* });
|
||||
*/
|
||||
|
Reference in New Issue
Block a user