From db53db7007d797a9e4b566ba2ac7f99d6c48791b Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sun, 24 Feb 2019 19:25:06 +0100 Subject: [PATCH] adjust to new ObservableMap api --- src/matrix/room/room.js | 2 +- src/matrix/session.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/matrix/room/room.js b/src/matrix/room/room.js index 5d4fcd98..db963cdb 100644 --- a/src/matrix/room/room.js +++ b/src/matrix/room/room.js @@ -17,7 +17,7 @@ export default class Room extends EventEmitter { this._persister.persistSync(roomResponse, txn); if (changed) { this.emit("change"); - (this._emitCollectionChange)(); + (this._emitCollectionChange)(this); } } diff --git a/src/matrix/session.js b/src/matrix/session.js index 49019ed3..4f7eb75a 100644 --- a/src/matrix/session.js +++ b/src/matrix/session.js @@ -5,8 +5,8 @@ export default class Session { constructor(storage) { this._storage = storage; this._session = null; - // use Map here? this._rooms = new ObservableMap(); + this._roomUpdateCallback = (room, params) => this._rooms.update(room.id, params); } // should be called before load // loginData has device_id, user_id, home_server, access_token @@ -47,8 +47,7 @@ export default class Session { } createRoom(roomId) { - const updateCallback = (params) => this._rooms.update(roomId, params); - const room = new Room(roomId, this._storage, updateCallback); + const room = new Room(roomId, this._storage, this._roomUpdateCallback); this._rooms.add(roomId, room); return room; }