forked from mystiq/hydrogen-web
adjust to new ObservableMap api
This commit is contained in:
parent
4d28448920
commit
db53db7007
2 changed files with 3 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue