Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
fix(dev): try to clean up on refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Sep 25, 2020
1 parent 04dcac9 commit dc40235
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/api/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ export class APIStream {
}
});

window.addEventListener('beforeunload', (ev: BeforeUnloadEvent) => {
console.debug('APIStream.beforeunload: completing subject');
this.subject.complete();
console.debug('APIStream.beforeunload: closing source');
this.closeSource();
console.debug('APIStream.beforeunload: removing app listeners');
App.removeAllListeners();
});

this.ready = new Promise(async (resolve) => {
await this.platform.ready();
await this.start();
Expand Down

0 comments on commit dc40235

Please sign in to comment.