From 662ab91908969a973bd8f3c7c6f3b8a961dec7b5 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 19 Jul 2018 01:00:46 +0200 Subject: Add detach warning --- pointless/viewer/stage.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pointless/viewer/stage.js') diff --git a/pointless/viewer/stage.js b/pointless/viewer/stage.js index 68fdb45..7995de6 100644 --- a/pointless/viewer/stage.js +++ b/pointless/viewer/stage.js @@ -19,6 +19,7 @@ class Stage { this.projector.addEventListener("load", function() { self.audienceScreen = new Screen(self.projector, false, false); self.presenterScreen = new Screen(window, true, true); + self._watchDetach(); onReady(); }); @@ -51,4 +52,17 @@ class Stage { return this.onPrevious(); } } + + _watchDetach() { + var self = this; + window.addEventListener("beforeunload", function() { + var messageBar = self.projector.document.getElementById("message"); + messageBar.textContent = "Controller detached"; + }); + + this.projector.addEventListener("beforeunload", function() { + var messageBar = document.getElementById("message"); + messageBar.textContent = "Viewer detached"; + }); + } } -- cgit v1.2.3