Skip to content

Commit

Permalink
fix(web): stop on window unload (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz authored Apr 4, 2022
1 parent cce585d commit 22f4bd7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export class TextToSpeechWeb extends WebPlugin implements TextToSpeechPlugin {
super();
if ('speechSynthesis' in window) {
this.speechSynthesis = window.speechSynthesis;
window.addEventListener('beforeunload', () => {
this.stop();
});
}
}

Expand Down

0 comments on commit 22f4bd7

Please sign in to comment.