1
0
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:
Kegan Dougal
2015-06-11 10:54:25 +01:00
parent 58cbd3ab1b
commit 07f77c495b
4 changed files with 118 additions and 93 deletions

View File

@@ -57,8 +57,12 @@ RoomState.prototype = {
/**
* Add an array of one or more state MatrixEvents, overwriting
* any existing state with the same {type, stateKey} tuple.
* any existing state with the same {type, stateKey} tuple. Will fire
* "RoomState.events" for every event added. May fire "RoomState.members"
* if there are <code>m.room.member</code> events.
* @param {MatrixEvent[]} stateEvents a list of state events for this room.
* @fires module:client~MatrixClient#event:"RoomState.members"
* @fires module:client~MatrixClient#event:"RoomState.events"
*/
setStateEvents: function(stateEvents) {
var self = this;
@@ -105,3 +109,28 @@ RoomState.prototype = {
* The RoomState class.
*/
module.exports = RoomState;
/**
* Fires whenever the event dictionary in room state is updated.
* @event module:client~MatrixClient#"RoomState.events"
* @param {MatrixEvent} event The matrix event which caused this event to fire.
* @param {RoomState} state The room state whose RoomState.events dictionary
* was updated.
* @example
* matrixClient.on("RoomState.events", function(event, state){
* var newStateEvent = event;
* });
*/
/**
* Fires whenever the member dictionary in room state is updated.
* @event module:client~MatrixClient#"RoomState.members"
* @param {MatrixEvent} event The matrix event which caused this event to fire.
* @param {RoomState} state The room state whose RoomState.members dictionary
* was updated.
* @param {RoomMember} member The room member that was updated.
* @example
* matrixClient.on("RoomState.members", function(event, state, member){
* var newMembershipState = member.getMembershipState();
* });
*/