From 4645073ed73d977c19aaa02a335420b10571c7d5 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 21 Jun 2020 13:29:32 +0200 Subject: Well, I don't need a thesis in corona-times --- plugin/multiplex/master.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 plugin/multiplex/master.js (limited to 'plugin/multiplex/master.js') diff --git a/plugin/multiplex/master.js b/plugin/multiplex/master.js new file mode 100644 index 0000000..7f4bf45 --- /dev/null +++ b/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 ); + +}()); -- cgit v1.2.3