From a7683d7f2b3611dd1429fd5725a32f12b78ba7d9 Mon Sep 17 00:00:00 2001 From: Nokome Bentley Date: Thu, 31 May 2018 14:13:38 +1200 Subject: [PATCH] Stop the host on window unload --- src/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app.js b/src/app.js index 2c8cc29..b302804 100644 --- a/src/app.js +++ b/src/app.js @@ -44,3 +44,8 @@ window.addEventListener('load', () => { }, window.document.body) }) }) + +window.addEventListener('beforeunload', () => { + // Stop the host (and any peer hosts that it has spawned) + host.stop() +})