server notes sync slide changes both ways, fixes #1425
This commit is contained in:
parent
4be55f860e
commit
215617740d
|
@ -45,6 +45,11 @@
|
||||||
post();
|
post();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
// When the state changes from inside of the speaker view
|
||||||
|
socket.on( 'statechanged-speaker', function( data ) {
|
||||||
|
Reveal.setState( data.state );
|
||||||
|
} );
|
||||||
|
|
||||||
// Monitor events that trigger a change in state
|
// Monitor events that trigger a change in state
|
||||||
Reveal.addEventListener( 'slidechanged', post );
|
Reveal.addEventListener( 'slidechanged', post );
|
||||||
Reveal.addEventListener( 'fragmentshown', post );
|
Reveal.addEventListener( 'fragmentshown', post );
|
||||||
|
|
|
@ -26,6 +26,10 @@ io.on( 'connection', function( socket ) {
|
||||||
socket.broadcast.emit( 'statechanged', data );
|
socket.broadcast.emit( 'statechanged', data );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on( 'statechanged-speaker', function( data ) {
|
||||||
|
socket.broadcast.emit( 'statechanged-speaker', data );
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
[ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) {
|
[ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) {
|
||||||
|
|
|
@ -221,6 +221,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Messages sent by reveal.js inside of the current slide preview
|
||||||
|
if( data && data.namespace === 'reveal' ) {
|
||||||
|
if( /slidechanged|fragmentshown|fragmenthidden|overviewshown|overviewhidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
|
||||||
|
socket.emit( 'statechanged-speaker', { state: data.state } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user