1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-01 21:21:58 +03:00

Add User.getLastModifiedTime()

This commit is contained in:
Kegan Dougal
2015-10-13 10:11:22 +01:00
parent 3baab40bdb
commit 1260dcee76

View File

@@ -29,6 +29,7 @@ function User(userId) {
presence: null,
profile: null
};
this._updateModifiedTime();
}
utils.inherits(User, EventEmitter);
@@ -64,11 +65,23 @@ User.prototype.setPresenceEvent = function(event) {
this.avatarUrl = event.getContent().avatar_url;
this.lastActiveAgo = event.getContent().last_active_ago;
if (eventsToFire.length > 0) {
this._updateModifiedTime();
}
for (var i = 0; i < eventsToFire.length; i++) {
this.emit(eventsToFire[i], event, this);
}
};
User.prototype._updateModifiedTime = function() {
this._modified = Date.now();
};
User.prototype.getLastModifiedTime = function() {
return this._modified;
};
/**
* The User class.
*/