add 'ready' event (#182)
authorHakim El Hattab <hakim.elhattab@gmail.com>
Wed, 17 Oct 2012 04:20:42 +0000 (00:20 -0400)
committerHakim El Hattab <hakim.elhattab@gmail.com>
Wed, 17 Oct 2012 04:20:42 +0000 (00:20 -0400)
README.md
js/reveal.js
js/reveal.min.js

index 91c4e06ea48710ba33e4665533482f665a6d3d15..9a7007e8afa88977e2555fbc3b788de221e7058b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -154,6 +154,16 @@ Reveal.addEventListener( 'somestate', function() {
 }, false );
 ```
 
+### Ready event
+
+The 'ready' event is fired when reveal.js has loaded all (synchronous) dependencies and is ready to start navigating.
+
+```javascript
+Reveal.addEventListener( 'ready', function( event ) {
+       // event.currentSlide, event.indexh, event.indexv
+} );
+```
+
 ### Slide change event
 
 An 'slidechanged' event is fired each time the slide is changed (regardless of state). The event object holds the index values of the current slide as well as a reference to the previous and current slide HTML nodes.
index c1ffb8fef01cd93f490d88f0d2328b7ea1545279..e53195f6a0fa1d9465598ef4c74bdee2af29560b 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * reveal.js 2.1 r33
+ * reveal.js 2.1 r34
  * http://lab.hakim.se/reveal-js
  * MIT licensed
  * 
@@ -267,6 +267,13 @@ 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
+               } );
        }
 
        /**
index 8f253206a231b1a0f8784397cc68bf9e7c8c98fb..e844a757a7c2799631d822ccc052b7daffa7a549 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * reveal.js 2.1 r33
+ * reveal.js 2.1 r34
  * http://lab.hakim.se/reveal-js
  * MIT licensed
  * 
@@ -18,10 +18,10 @@ 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 al=[],ap=[];
 for(var am=0,ak=R.dependencies.length;am<ak;am++){var an=R.dependencies[am];if(!an.condition||an.condition()){if(an.async){ap.push(an.src);}else{al.push(an.src);
 }if(typeof an.callback==="function"){head.ready(an.src.match(/([\w\d_\-]*)\.?[^\\\/]*$/i)[0],an.callback);}}}function ao(){head.js.apply(null,ap);H();}if(al.length){head.ready(ao);
-head.js.apply(null,al);}else{ao();}}function H(){E();K();J();O();}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 am=f.theme.getAttribute("href");var ak=/[^\/]*?(?=\.css)/;
-var al=am.match(ak)[0];if(R.theme!==al){am=am.replace(ak,R.theme);f.theme.setAttribute("href",am);}}}function E(){document.addEventListener("touchstart",A,false);
+head.js.apply(null,al);}else{ao();}}function H(){E();K();J();O();r("ready",{indexh:m,indexv:e,currentSlide:G});}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 am=f.theme.getAttribute("href");
+var ak=/[^\/]*?(?=\.css)/;var al=am.match(ak)[0];if(R.theme!==al){am=am.replace(ak,R.theme);f.theme.setAttribute("href",am);}}}function E(){document.addEventListener("touchstart",A,false);
 document.addEventListener("touchmove",af,false);document.addEventListener("touchend",W,false);window.addEventListener("hashchange",w,false);if(R.keyboard){document.addEventListener("keydown",ah,false);
 }if(R.controls&&f.controls){f.controlsLeft.addEventListener("click",q(B),false);f.controlsRight.addEventListener("click",q(j),false);f.controlsUp.addEventListener("click",q(u),false);
 f.controlsDown.addEventListener("click",q(F),false);}}function U(){document.removeEventListener("keydown",ah,false);document.removeEventListener("touchstart",A,false);