aboutsummaryrefslogtreecommitdiffhomepage
path: root/presentation/plugin/multiplex/master.js
diff options
context:
space:
mode:
authorMarvin Borner2019-06-23 12:42:22 +0200
committerMarvin Borner2019-06-23 12:42:22 +0200
commit0740711fdeadb4765a2e1f495ed85b4846ef926f (patch)
treeb320803d4dec601c359bcabf82e0c8bfae8c8d7e /presentation/plugin/multiplex/master.js
parentce9c06fd5e41f77df6e0dbcc553e2ca290e20207 (diff)
Began presentation
Diffstat (limited to 'presentation/plugin/multiplex/master.js')
-rw-r--r--presentation/plugin/multiplex/master.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/presentation/plugin/multiplex/master.js b/presentation/plugin/multiplex/master.js
new file mode 100644
index 0000000..df7a68c
--- /dev/null
+++ b/presentation/plugin/multiplex/master.js
@@ -0,0 +1,36 @@
+(function () {
+
+ // Don't emit events from inside of notes windows
+ if (window.location.search.match(/receiver/gi)) {
+ return;
+ }
+
+ var multiplex = Reveal.getConfig().multiplex;
+
+ var socket = io.connect(multiplex.url);
+
+ function post() {
+
+ var messageData = {
+ state: Reveal.getState(),
+ secret: multiplex.secret,
+ socketId: multiplex.id
+ };
+
+ socket.emit('multiplex-statechanged', messageData);
+
+ }
+
+ // post once the page is loaded, so the client follows also on "open URL".
+ window.addEventListener('load', post);
+
+ // Monitor events that trigger a change in state
+ Reveal.addEventListener('slidechanged', post);
+ Reveal.addEventListener('fragmentshown', post);
+ Reveal.addEventListener('fragmenthidden', post);
+ Reveal.addEventListener('overviewhidden', post);
+ Reveal.addEventListener('overviewshown', post);
+ Reveal.addEventListener('paused', post);
+ Reveal.addEventListener('resumed', post);
+
+}());