aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2018-07-19 01:00:46 +0200
committerpacien2018-07-19 01:00:46 +0200
commit662ab91908969a973bd8f3c7c6f3b8a961dec7b5 (patch)
tree72b9be46c65b3454d80eca8578bc9c79f4be4b6e
parentd0f01fdec2c36cc491c5af0dec97081f548feaaa (diff)
downloadbeamer-viewer-662ab91908969a973bd8f3c7c6f3b8a961dec7b5.tar.gz
Add detach warning
-rw-r--r--pointless/viewer/stage.js14
1 files changed, 14 insertions, 0 deletions
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 {
19 this.projector.addEventListener("load", function() { 19 this.projector.addEventListener("load", function() {
20 self.audienceScreen = new Screen(self.projector, false, false); 20 self.audienceScreen = new Screen(self.projector, false, false);
21 self.presenterScreen = new Screen(window, true, true); 21 self.presenterScreen = new Screen(window, true, true);
22 self._watchDetach();
22 onReady(); 23 onReady();
23 }); 24 });
24 25
@@ -51,4 +52,17 @@ class Stage {
51 return this.onPrevious(); 52 return this.onPrevious();
52 } 53 }
53 } 54 }
55
56 _watchDetach() {
57 var self = this;
58 window.addEventListener("beforeunload", function() {
59 var messageBar = self.projector.document.getElementById("message");
60 messageBar.textContent = "Controller detached";
61 });
62
63 this.projector.addEventListener("beforeunload", function() {
64 var messageBar = document.getElementById("message");
65 messageBar.textContent = "Viewer detached";
66 });
67 }
54} 68}