1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-19 16:42:09 +03:00

Add RoomState.getLastModifiedTime() and JSDoc

This commit is contained in:
Kegan Dougal
2015-10-13 10:18:01 +01:00
parent 1260dcee76
commit 2bb65fe644
3 changed files with 27 additions and 0 deletions

View File

@@ -134,6 +134,12 @@ RoomMember.prototype._updateModifiedTime = function() {
this._modified = Date.now();
};
/**
* Get the timestamp when this RoomMember was last updated. This timestamp is
* updated when properties on this RoomMember are updated.
* It is updated <i>before</i> firing events.
* @return {number} The timestamp
*/
RoomMember.prototype.getLastModifiedTime = function() {
return this._modified;
};

View File

@@ -30,6 +30,7 @@ function RoomState(roomId) {
this._sentinels = {
// userId: RoomMember
};
this._updateModifiedTime();
}
utils.inherits(RoomState, EventEmitter);
@@ -96,6 +97,7 @@ RoomState.prototype.getStateEvents = function(eventType, stateKey) {
*/
RoomState.prototype.setStateEvents = function(stateEvents) {
var self = this;
this._updateModifiedTime();
// update the core event dict
utils.forEach(stateEvents, function(event) {
@@ -162,6 +164,19 @@ RoomState.prototype.setTypingEvent = function(event) {
});
};
RoomState.prototype._updateModifiedTime = function() {
this._modified = Date.now();
};
/**
* Get the timestamp when this room state was last updated. This timestamp is
* updated when this object has received new state events.
* @return {number} The timestamp
*/
RoomState.prototype.getLastModifiedTime = function() {
return this._modified;
};
/**
* The RoomState class.
*/

View File

@@ -78,6 +78,12 @@ User.prototype._updateModifiedTime = function() {
this._modified = Date.now();
};
/**
* Get the timestamp when this User was last updated. This timestamp is
* updated when this User receives a new Presence event which has updated a
* property on this object. It is updated <i>before</i> firing events.
* @return {number} The timestamp
*/
User.prototype.getLastModifiedTime = function() {
return this._modified;
};