master.js 819 B

12345678910111213141516171819202122232425262728293031
  1. (function() {
  2. // Don't emit events from inside of notes windows
  3. if ( window.location.search.match( /receiver/gi ) ) { return; }
  4. var multiplex = Reveal.getConfig().multiplex;
  5. var socket = io.connect( multiplex.url );
  6. function post() {
  7. var messageData = {
  8. state: Reveal.getState(),
  9. secret: multiplex.secret,
  10. socketId: multiplex.id
  11. };
  12. socket.emit( 'multiplex-statechanged', messageData );
  13. };
  14. // Monitor events that trigger a change in state
  15. Reveal.addEventListener( 'slidechanged', post );
  16. Reveal.addEventListener( 'fragmentshown', post );
  17. Reveal.addEventListener( 'fragmenthidden', post );
  18. Reveal.addEventListener( 'overviewhidden', post );
  19. Reveal.addEventListener( 'overviewshown', post );
  20. Reveal.addEventListener( 'paused', post );
  21. Reveal.addEventListener( 'resumed', post );
  22. }());