Unsubscribe on dispose
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
7b811aa927
commit
88a1e34987
1 changed files with 11 additions and 1 deletions
|
@ -5,7 +5,8 @@ export class RoomDetailsViewModel extends ViewModel {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
this._room = options.room;
|
this._room = options.room;
|
||||||
this._room.on("change", () => this.emitChange());
|
this._onRoomChange = this._onRoomChange.bind(this);
|
||||||
|
this._room.on("change", this._onRoomChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
get roomId() {
|
get roomId() {
|
||||||
|
@ -44,8 +45,17 @@ export class RoomDetailsViewModel extends ViewModel {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onRoomChange() {
|
||||||
|
this.emitChange();
|
||||||
|
}
|
||||||
|
|
||||||
closePanel() {
|
closePanel() {
|
||||||
const path = this.navigation.path.until("room");
|
const path = this.navigation.path.until("room");
|
||||||
this.navigation.applyPath(path);
|
this.navigation.applyPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dispose() {
|
||||||
|
super.dispose();
|
||||||
|
this._room.off("change", this._onRoomChange);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue