-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
1,163 additions
and
3 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
_freeze/schedule/slides/20-boosting/execute-results/html.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
(function() { | ||
|
||
// emulate async script load | ||
window.addEventListener( 'load', function() { | ||
var multiplex = Reveal.getConfig().multiplex; | ||
var socketId = multiplex.id; | ||
var socket = io.connect(multiplex.url); | ||
|
||
function post( evt ) { | ||
var messageData = { | ||
state: Reveal.getState(), | ||
secret: multiplex.secret, | ||
socketId: multiplex.id, | ||
content: (evt || {}).content | ||
}; | ||
socket.emit( 'multiplex-statechanged', messageData ); | ||
}; | ||
|
||
// master | ||
if (multiplex.secret !== null) { | ||
|
||
// Don't emit events from inside of notes windows | ||
if ( window.location.search.match( /receiver/gi ) ) { return; } | ||
|
||
// post once the page is loaded, so the client follows also on "open URL". | ||
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 ); | ||
document.addEventListener( 'send', post ); // broadcast custom events sent by other plugins | ||
|
||
// client | ||
} else { | ||
socket.on(multiplex.id, function(message) { | ||
// ignore data from sockets that aren't ours | ||
if (message.socketId !== socketId) { return; } | ||
if( window.location.host === 'localhost:1947' ) return; | ||
|
||
if ( message.state ) { | ||
Reveal.setState(message.state); | ||
} | ||
if ( message.content ) { | ||
// forward custom events to other plugins | ||
var event = new CustomEvent('received'); | ||
event.content = message.content; | ||
document.dispatchEvent( event ); | ||
} | ||
}); | ||
} | ||
}); | ||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: multiplex | ||
script: [socket.io.js, multiplex.js] | ||
register: false | ||
config: | ||
multiplex: | ||
secret: null | ||
id: null | ||
url: "https://reveal-multiplex.glitch.me/" |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.