Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
removelistener
Browse files Browse the repository at this point in the history
Signed-off-by: Kerry Archibald <kerrya@element.io>
  • Loading branch information
Kerry Archibald committed Mar 29, 2022
1 parent 7fbecdc commit e9c2de4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/stores/OwnBeaconStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export class OwnBeaconStore extends AsyncStoreWithClient<OwnBeaconStoreState> {
protected async onNotReady() {
this.matrixClient.removeListener(BeaconEvent.LivenessChange, this.onBeaconLiveness);
this.matrixClient.removeListener(BeaconEvent.New, this.onNewBeacon);
this.matrixClient.removeListener(RoomStateEvent.Members, this.onRoomStateMembers);

this.beacons.forEach(beacon => beacon.destroy());

Expand Down
1 change: 1 addition & 0 deletions test/stores/OwnBeaconStore-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ describe('OwnBeaconStore', () => {

expect(removeSpy.mock.calls[0]).toEqual(expect.arrayContaining([BeaconEvent.LivenessChange]));
expect(removeSpy.mock.calls[1]).toEqual(expect.arrayContaining([BeaconEvent.New]));
expect(removeSpy.mock.calls[2]).toEqual(expect.arrayContaining([RoomStateEvent.Members]));
});

it('destroys beacons', async () => {
Expand Down

0 comments on commit e9c2de4

Please sign in to comment.