Add event listener 'fragmentshown' and 'fragmenthidden'
authorMichael Kühnel <mail@michael-kuehnel.de>
Thu, 18 Oct 2012 22:04:40 +0000 (00:04 +0200)
committerMichael Kühnel <mail@michael-kuehnel.de>
Thu, 18 Oct 2012 22:04:40 +0000 (00:04 +0200)
And emit 'fragmentchanged' with the appropriate fragmentData to show or hide fragments.

plugin/speakernotes/client.js

index 43dc1264b709551ab314bbdbf8cb49a8e77a13e1..757e6cdff88b182eac403c7b1d82baef27861db1 100644 (file)
@@ -8,6 +8,25 @@
        console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId);
        window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId);
 
+       // Fires when a fragment is shown
+       Reveal.addEventListener( 'fragmentshown', function( event ) {
+               var fragmentData = {
+                       showFragment : true,
+                       socketId : socketId
+               };
+               socket.emit('fragmentchanged', fragmentData);
+       } );
+
+       // Fires when a fragment is hidden
+       Reveal.addEventListener( 'fragmenthidden', function( event ) {
+               var fragmentData = {
+                       hideFragment : true,
+                       socketId : socketId
+               };
+               socket.emit('fragmentchanged', fragmentData);
+       } );
+
+       // Fires when slide is changed
        Reveal.addEventListener( 'slidechanged', function( event ) {
                var nextindexh;
                var nextindexv;