From 4777afe0c562c40b388c304d00bcd07b42836901 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Wed, 24 Oct 2012 21:42:10 -0400 Subject: [PATCH] force 'ready' to fire one cycle later (#208) --- js/reveal.js | 17 ++++++++++------- js/reveal.min.js | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/js/reveal.js b/js/reveal.js index fcc064d4..11946570 100644 --- a/js/reveal.js +++ b/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 ); } /** diff --git a/js/reveal.min.js b/js/reveal.min.js index 958d271d..f82e0402 100644 --- a/js/reveal.min.js +++ b/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