瀏覽代碼

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

hakimel 3 年之前
父節點
當前提交
2a239aedca

文件差異過大導致無法顯示
+ 0 - 0
dist/reveal.esm.js


文件差異過大導致無法顯示
+ 0 - 0
dist/reveal.esm.js.map


文件差異過大導致無法顯示
+ 0 - 0
dist/reveal.js


文件差異過大導致無法顯示
+ 0 - 0
dist/reveal.js.map


+ 1 - 1
js/controllers/location.js

@@ -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 ) {
 

文件差異過大導致無法顯示
+ 0 - 0
plugin/notes/notes.esm.js


文件差異過大導致無法顯示
+ 0 - 0
plugin/notes/notes.js


+ 9 - 1
plugin/notes/speaker-view.html

@@ -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.
 				 */

部分文件因文件數量過多而無法顯示