diff options
author | Hakim El Hattab | 2018-10-04 12:32:28 +0200 |
---|---|---|
committer | Hakim El Hattab | 2018-10-04 12:32:37 +0200 |
commit | 8582c9aac8888bc71d2658377778279a5d5f0c34 (patch) | |
tree | 4c38d89653af23ec9f4126b4fc1fd915b2eabbad /plugin/notes/notes.js | |
parent | 90fc0bc466c505b5e3b6ce68532565f3dd0745ae (diff) | |
parent | 250580fc4c97f83185e46f9d0e22286d0a01d3af (diff) |
resolve notes merge conflict
Diffstat (limited to 'plugin/notes/notes.js')
-rw-r--r-- | plugin/notes/notes.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index a5b15b4..552a6fe 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -26,9 +26,6 @@ var RevealNotes = (function() { return; } - // Allow popup window access to Reveal API - notesPopup.Reveal = window.Reveal; - /** * Connect to the notes window through a postmessage handshake. * Using postmessage enables us to work in situations where the @@ -52,10 +49,27 @@ var RevealNotes = (function() { clearInterval( connectInterval ); onConnected(); } + if( data && data.namespace === 'reveal-notes' && data.type === 'call' ) { + callRevealApi( data.methodName, data.arguments, data.callId ); + } } ); } /** + * Calls the specified Reveal.js method with the provided argument and then pushes the result to the notes + * frame. + */ + function callRevealApi( methodName, methodArguments, callId ) { + var result = Reveal[methodName].call(Reveal, methodArguments); + notesPopup.postMessage( JSON.stringify( { + namespace: 'reveal-notes', + type: 'return', + result: result, + callId: callId + } ), '*' ); + } + + /** * Posts the current slide data to the notes window */ function post( event ) { |