master.js 939 B

12345678910111213141516171819202122232425262728293031323334
  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. // post once the page is loaded, so the client follows also on "open URL".
  15. window.addEventListener( 'load', post );
  16. // Monitor events that trigger a change in state
  17. Reveal.addEventListener( 'slidechanged', post );
  18. Reveal.addEventListener( 'fragmentshown', post );
  19. Reveal.addEventListener( 'fragmenthidden', post );
  20. Reveal.addEventListener( 'overviewhidden', post );
  21. Reveal.addEventListener( 'overviewshown', post );
  22. Reveal.addEventListener( 'paused', post );
  23. Reveal.addEventListener( 'resumed', post );
  24. }());