revproxy-presentation/plugin/multiplex/master.js

31 lines
819 B
JavaScript
Raw Normal View History

2012-08-05 15:48:55 +02:00
(function() {
2013-09-15 17:52:40 +02:00
// Don't emit events from inside of notes windows
2012-08-05 15:48:55 +02:00
if ( window.location.search.match( /receiver/gi ) ) { return; }
2013-09-15 17:52:40 +02:00
var multiplex = Reveal.getConfig().multiplex;
2012-08-05 15:48:55 +02:00
var socket = io.connect( multiplex.url );
function post() {
var messageData = {
state: Reveal.getState(),
secret: multiplex.secret,
socketId: multiplex.id
};
socket.emit( 'multiplex-statechanged', messageData );
};
// 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 );
}());