2012-08-05 13:48:55 +00:00
|
|
|
(function() {
|
2015-09-29 08:38:34 +00:00
|
|
|
|
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
|
|
|
|
2013-03-09 00:05:58 +00:00
|
|
|
var multiplex = Reveal.getConfig().multiplex;
|
2012-08-05 13:48:55 +00:00
|
|
|
|
2015-09-29 08:38:34 +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 );
|
|
|
|
|
2013-04-05 18:45:17 +00:00
|
|
|
};
|
|
|
|
|
2017-06-06 08:36:40 +00:00
|
|
|
// post once the page is loaded, so the client follows also on "open URL".
|
|
|
|
window.onload = post;
|
|
|
|
|
2015-09-29 08:38:34 +00:00
|
|
|
// 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 );
|
|
|
|
|
2017-06-06 08:36:40 +00:00
|
|
|
}());
|