MCPcopy
hub / github.com/hakimel/reveal.js / connect

Function connect

plugin/notes/plugin.js:68–87  ·  view source on GitHub ↗

* Connect to the notes window through a postmessage handshake. * Using postmessage enables us to work in situations where the * origins differ, such as a presentation being opened from the * file system.

()

Source from the content-addressed store, hash-verified

66 * file system.
67 */
68 function connect() {
69
70 const presentationURL = deck.getConfig().url;
71
72 const url = typeof presentationURL === 'string' ? presentationURL :
73 window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
74
75 // Keep trying to connect until we get a 'connected' message back
76 connectInterval = setInterval( function() {
77 speakerWindow.postMessage( JSON.stringify( {
78 namespace: 'reveal-notes',
79 type: 'connect',
80 state: deck.getState(),
81 url
82 } ), '*' );
83 }, 500 );
84
85 window.addEventListener( 'message', onPostMessage );
86
87 }
88
89 /**
90 * Calls the specified Reveal.js method with the provided argument

Callers 1

openSpeakerWindowFunction · 0.85

Calls 2

getConfigMethod · 0.80
getStateMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…