name changes

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-06-30 15:35:48 +05:30
parent ad6122a5b6
commit da1e981948

View File

@ -11,25 +11,25 @@ export class RightPanelViewModel extends ViewModel {
get activeViewModel() { return this._activeViewModel; } get activeViewModel() { return this._activeViewModel; }
async _memberArguments() { async _getMemberArguments() {
const list = await this._room.loadMemberList(); const list = await this._room.loadMemberList();
const room = this._room; const room = this._room;
return {members: list.members, powerLevels: room.powerLevels, mediaRepository: room.mediaRepository}; return {members: list.members, powerLevels: room.powerLevels, mediaRepository: room.mediaRepository};
} }
_setupNavigation() { _setupNavigation() {
this._hookSegmentToToggler("details", RoomDetailsViewModel, () => { return {room: this._room}; }); this._hookUpdaterToSegment("details", RoomDetailsViewModel, () => { return {room: this._room}; });
this._hookSegmentToToggler("members", MemberListViewModel, () => this._memberArguments()); this._hookUpdaterToSegment("members", MemberListViewModel, () => this._getMemberArguments());
} }
_hookSegmentToToggler(segment, viewmodel, argCreator) { _hookUpdaterToSegment(segment, viewmodel, argCreator) {
const observable = this.navigation.observe(segment); const observable = this.navigation.observe(segment);
const toggler = this._setupToggler(segment, viewmodel, argCreator); const updater = this._setupUpdater(segment, viewmodel, argCreator);
this.track(observable.subscribe(() => toggler())); this.track(observable.subscribe(() => updater()));
} }
_setupToggler(segment, viewmodel, argCreator) { _setupUpdater(segment, viewmodel, argCreator) {
const toggler = async (skipDispose = false) => { const updater = async (skipDispose = false) => {
if (!skipDispose) { if (!skipDispose) {
this._activeViewModel = this.disposeTracked(this._activeViewModel); this._activeViewModel = this.disposeTracked(this._activeViewModel);
} }
@ -40,7 +40,7 @@ export class RightPanelViewModel extends ViewModel {
} }
this.emitChange("activeViewModel"); this.emitChange("activeViewModel");
}; };
toggler(true); updater(true);
return toggler; return updater;
} }
} }