mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-02-14 17:49:59 +00:00
22 lines
446 B
JavaScript
22 lines
446 B
JavaScript
/* This snippet is loaded from the workshop HTML file.
|
|
* It sets up callbacks to synchronize the local slide
|
|
* number with the remote pub/sub server.
|
|
*/
|
|
|
|
var socket = io();
|
|
var leader = true;
|
|
|
|
slideshow.on('showSlide', function (slide) {
|
|
if (leader) {
|
|
var n = slide.getSlideIndex()+1;
|
|
socket.emit('slide change', n);
|
|
}
|
|
});
|
|
|
|
socket.on('slide change', function (n) {
|
|
leader = false;
|
|
slideshow.gotoSlide(n);
|
|
leader = true;
|
|
});
|
|
|