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
Emit events for read receipts
This commit is contained in:
@@ -2466,7 +2466,7 @@ function createNewUser(client, userId) {
|
||||
|
||||
function createNewRoom(client, roomId) {
|
||||
var room = new Room(roomId);
|
||||
reEmit(client, room, ["Room.name", "Room.timeline"]);
|
||||
reEmit(client, room, ["Room.name", "Room.timeline", "Room.receipt"]);
|
||||
|
||||
// we need to also re-emit room state and room member events, so hook it up
|
||||
// to the client now. We need to add a listener for RoomState.members in
|
||||
|
@@ -399,6 +399,10 @@ Room.prototype.addReceipt = function(event) {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// send events after we've regenerated the cache, otherwise things that
|
||||
// listened for the event would read from a stale cache
|
||||
this.emit("Room.receipt", event, this);
|
||||
};
|
||||
|
||||
function setEventMetadata(event, stateContext, toStartOfTimeline) {
|
||||
@@ -527,3 +531,14 @@ module.exports = Room;
|
||||
* var newName = room.name;
|
||||
* });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fires whenever a receipt is received for a room
|
||||
* @event module:client~MatrixClient#"Room.receipt"
|
||||
* @param {event} event The receipt event
|
||||
* @param {Room} room The room whose Room.name was updated.
|
||||
* @example
|
||||
* matrixClient.on("Room.receipt", function(event, room){
|
||||
* var receiptContent = event.getContent();
|
||||
* });
|
||||
*/
|
||||
|
Reference in New Issue
Block a user