Improve typing around event emitter handlers (#7816)

This commit is contained in:
Michael Telatynski
2022-02-22 12:18:08 +00:00
committed by GitHub
parent 213b32bf14
commit 7fa01ffb06
79 changed files with 548 additions and 471 deletions

View File

@@ -16,6 +16,7 @@
import { Room } from "matrix-js-sdk/src/models/room";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { RoomStateEvent } from "matrix-js-sdk/src/models/room-state";
import { Optional } from "matrix-events-sdk";
import SettingsStore from "../../settings/SettingsStore";
@@ -130,7 +131,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
protected async onReady(): Promise<any> {
this.updateAllRooms();
this.matrixClient.on("RoomState.events", this.updateRoomFromState);
this.matrixClient.on(RoomStateEvent.Events, this.updateRoomFromState);
this.pinnedRef = SettingsStore.watchSetting("Widgets.pinned", null, this.updateFromSettings);
this.layoutRef = SettingsStore.watchSetting("Widgets.layout", null, this.updateFromSettings);
WidgetStore.instance.on(UPDATE_EVENT, this.updateFromWidgetStore);
@@ -139,6 +140,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
protected async onNotReady(): Promise<any> {
this.byRoom = {};
this.matrixClient?.off(RoomStateEvent.Events, this.updateRoomFromState);
SettingsStore.unwatchSetting(this.pinnedRef);
SettingsStore.unwatchSetting(this.layoutRef);
WidgetStore.instance.off(UPDATE_EVENT, this.updateFromWidgetStore);