1
0
Fork 0

split postmessage config into two options

This commit is contained in:
Hakim El Hattab 2014-04-19 10:53:33 +02:00
parent fea11d24bc
commit ce31184bf3
1 changed files with 6 additions and 6 deletions

View File

@ -89,9 +89,12 @@ var Reveal = (function(){
// Opens links in an iframe preview overlay // Opens links in an iframe preview overlay
previewLinks: false, previewLinks: false,
// Flags if we should listen to and dispatch events through window.postMessage // Exposes the reveal.js API through window.postMessage
postMessage: true, postMessage: true,
// Dispatches all reveal.js events to the parent window through postMessage
postMessageEvents: false,
// Focuses body when page changes visiblity to ensure keyboard shortcuts work // Focuses body when page changes visiblity to ensure keyboard shortcuts work
focusBodyOnPageVisiblityChange: true, focusBodyOnPageVisiblityChange: true,
@ -972,11 +975,8 @@ var Reveal = (function(){
// If we're in an iframe, post each reveal.js event to the // If we're in an iframe, post each reveal.js event to the
// parent window. Used by the notes plugin // parent window. Used by the notes plugin
if( config.postMessage && window.parent !== window.self ) { if( config.postMessageEvents && window.parent !== window.self ) {
// Remove arguments that can't be stringified (circular structures) window.parent.postMessage( JSON.stringify({ namespace: 'reveal', eventName: type, state: getState() }), '*' );
if( args && args.currentSlide ) delete args.currentSlide;
if( args && args.previousSlide ) delete args.previousSlide;
window.parent.postMessage( JSON.stringify({ namespace: 'reveal', eventName: type, eventArgs: args || null }), '*' );
} }
} }