diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-11-09 16:23:57 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2015-11-09 16:24:09 +0100 |
commit | 215617740d15f46022dce479f3f412b4d62f44f8 (patch) | |
tree | 874cca999751423e64496f6c8343ac79b4337e5d | |
parent | 4be55f860eb7fafa5c08c781e52660794ea2e9b3 (diff) | |
download | fosdem-2018-presentation-215617740d15f46022dce479f3f412b4d62f44f8.tar fosdem-2018-presentation-215617740d15f46022dce479f3f412b4d62f44f8.tar.gz |
server notes sync slide changes both ways, fixes #1425
-rw-r--r-- | plugin/notes-server/client.js | 5 | ||||
-rw-r--r-- | plugin/notes-server/index.js | 4 | ||||
-rw-r--r-- | plugin/notes-server/notes.html | 7 |
3 files changed, 16 insertions, 0 deletions
diff --git a/plugin/notes-server/client.js b/plugin/notes-server/client.js index 719b495..00b277b 100644 --- a/plugin/notes-server/client.js +++ b/plugin/notes-server/client.js @@ -45,6 +45,11 @@ post(); } ); + // When the state changes from inside of the speaker view + socket.on( 'statechanged-speaker', function( data ) { + Reveal.setState( data.state ); + } ); + // Monitor events that trigger a change in state Reveal.addEventListener( 'slidechanged', post ); Reveal.addEventListener( 'fragmentshown', post ); diff --git a/plugin/notes-server/index.js b/plugin/notes-server/index.js index 75838de..683f064 100644 --- a/plugin/notes-server/index.js +++ b/plugin/notes-server/index.js @@ -26,6 +26,10 @@ io.on( 'connection', function( socket ) { socket.broadcast.emit( 'statechanged', data ); }); + socket.on( 'statechanged-speaker', function( data ) { + socket.broadcast.emit( 'statechanged-speaker', data ); + }); + }); [ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) { diff --git a/plugin/notes-server/notes.html b/plugin/notes-server/notes.html index d924ad9..ad8c719 100644 --- a/plugin/notes-server/notes.html +++ b/plugin/notes-server/notes.html @@ -221,6 +221,13 @@ } } + // Messages sent by reveal.js inside of the current slide preview + if( data && data.namespace === 'reveal' ) { + if( /slidechanged|fragmentshown|fragmenthidden|overviewshown|overviewhidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) { + socket.emit( 'statechanged-speaker', { state: data.state } ); + } + } + } ); /** |