fossasia-22-renode/plugin/multiplex/master.js

35 lines
841 B
JavaScript
Raw Normal View History

2012-08-05 13:48:55 +00:00
(function() {
2013-09-15 15:52:40 +00:00
// Don't emit events from inside of notes windows
2012-08-05 13:48:55 +00:00
if ( window.location.search.match( /receiver/gi ) ) { return; }
2013-09-15 15:52:40 +00:00
var multiplex = Reveal.getConfig().multiplex;
2012-08-05 13:48:55 +00: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 );
};
// post once the page is loaded, so the client follows also on "open URL".
2017-06-12 07:17:46 +00:00
window.addEventListener( 'load', post );
// Monitor events that trigger a change in state
Reveal.on( 'slidechanged', post );
Reveal.on( 'fragmentshown', post );
Reveal.on( 'fragmenthidden', post );
Reveal.on( 'overviewhidden', post );
Reveal.on( 'overviewshown', post );
Reveal.on( 'paused', post );
Reveal.on( 'resumed', post );
}());