فهرست منبع

force 'ready' to fire one cycle later (#208)

Hakim El Hattab 11 سال پیش
والد
کامیت
4777afe0c5
2فایلهای تغییر یافته به همراه12 افزوده شده و 9 حذف شده
  1. 10 7
      js/reveal.js
  2. 2 2
      js/reveal.min.js

+ 10 - 7
js/reveal.js

@@ -1,5 +1,5 @@
 /*!
- * reveal.js 2.1 r35
+ * reveal.js 2.1 r36
  * http://lab.hakim.se/reveal-js
  * MIT licensed
  *
@@ -268,12 +268,15 @@ var Reveal = (function(){
 		// Start auto-sliding if it's enabled
 		cueAutoSlide();
 
-		// Notify listeners that the presentation is ready
-		dispatchEvent( 'ready', {
-			'indexh': indexh, 
-			'indexv': indexv,
-			'currentSlide': currentSlide
-		} );
+		// Notify listeners that the presentation is ready but use a 1ms
+		// timeout to ensure it's not fired synchronously after #initialize()
+		setTimeout( function() {
+			dispatchEvent( 'ready', {
+				'indexh': indexh,
+				'indexv': indexv,
+				'currentSlide': currentSlide
+			} );
+		}, 1 );
 	}
 
 	/**

+ 2 - 2
js/reveal.min.js

@@ -1,5 +1,5 @@
 /*!
- * reveal.js 2.1 r35
+ * reveal.js 2.1 r36
  * http://lab.hakim.se/reveal-js
  * MIT licensed
  *
@@ -17,7 +17,7 @@ f.controlsDown=document.querySelector(".reveal .controls .down");}}function d(){
 document.body.style.height="120%";window.addEventListener("load",ad,false);window.addEventListener("orientationchange",ad,false);}}function V(){var am=[],aq=[];
 for(var an=0,al=R.dependencies.length;an<al;an++){var ao=R.dependencies[an];if(!ao.condition||ao.condition()){if(ao.async){aq.push(ao.src);}else{am.push(ao.src);
 }if(typeof ao.callback==="function"){head.ready(ao.src.match(/([\w\d_\-]*)\.?[^\\\/]*$/i)[0],ao.callback);}}}function ap(){head.js.apply(null,aq);H();}if(am.length){head.ready(ap);
-head.js.apply(null,am);}else{ap();}}function H(){P();E();K();J();O();r("ready",{indexh:m,indexv:e,currentSlide:G});}function K(){if(T===false){R.transition="linear";
+head.js.apply(null,am);}else{ap();}}function H(){P();E();K();J();O();setTimeout(function(){r("ready",{indexh:m,indexv:e,currentSlide:G});},1);}function K(){if(T===false){R.transition="linear";
 }if(R.controls&&f.controls){f.controls.style.display="block";}if(R.progress&&f.progress){f.progress.style.display="block";}if(R.transition!=="default"){f.wrapper.classList.add(R.transition);
 }if(R.mouseWheel){document.addEventListener("DOMMouseScroll",o,false);document.addEventListener("mousewheel",o,false);}if(R.rollingLinks){N();}if(R.theme&&f.theme){var an=f.theme.getAttribute("href");
 var al=/[^\/]*?(?=\.css)/;var am=an.match(al)[0];if(R.theme!==am){an=an.replace(al,R.theme);f.theme.setAttribute("href",an);}}}function E(){document.addEventListener("touchstart",A,false);