summaryrefslogtreecommitdiffhomepage
path: root/presentation/plugin/multiplex/master.js
diff options
context:
space:
mode:
authorMarvin Borner2020-05-05 18:13:11 +0200
committerMarvin Borner2020-05-05 18:13:11 +0200
commite5ada93506f2b46f280c9334c0954e6b7c4f597d (patch)
tree019be692e1cb22b4b02c89231bd88cfc930d866c /presentation/plugin/multiplex/master.js
parenta840a022669adcc88fba3339378a0328d7b3032e (diff)
New project layout
Diffstat (limited to 'presentation/plugin/multiplex/master.js')
-rw-r--r--presentation/plugin/multiplex/master.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/presentation/plugin/multiplex/master.js b/presentation/plugin/multiplex/master.js
new file mode 100644
index 0000000..7f4bf45
--- /dev/null
+++ b/presentation/plugin/multiplex/master.js
@@ -0,0 +1,34 @@
+(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 );
+
+}());