debounce messages from notes -> main window, fixes #3147

edit
hakimel 2022-03-09 10:25:30 +01:00
parent fc861fca50
commit 2a239aedca
8 changed files with 16 additions and 8 deletions

2
dist/reveal.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/reveal.js vendored

File diff suppressed because one or more lines are too long

2
dist/reveal.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@ export default class Location {
// The minimum number of milliseconds that must pass between
// calls to history.replaceState
MAX_REPLACE_STATE_FREQUENCY = 250
MAX_REPLACE_STATE_FREQUENCY = 1000
constructor( Reveal ) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -403,13 +403,21 @@
}
else if( /slidechanged|fragmentshown|fragmenthidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
window.opener.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ]} ), '*' );
dispatchStateToMainWindow( data.state );
}
}
} );
/**
* Updates the presentation in the main window to match the state
* of the presentation in the notes window.
*/
const dispatchStateToMainWindow = debounce(( state ) => {
window.opener.postMessage( JSON.stringify({ method: 'setState', args: [ state ]} ), '*' );
}, 500);
/**
* Asynchronously calls the Reveal.js API of the main frame.
*/