diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2014-04-20 10:52:27 +0200 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2014-04-20 10:52:27 +0200 |
commit | 4a39aecbab17652b03bd863474dc0c458c96881a (patch) | |
tree | f43c648d0729469bf169150ce40523a704b42aee | |
parent | 3795ef1599cae8debe161c13a530ad565a767291 (diff) | |
download | fosdem-2018-presentation-4a39aecbab17652b03bd863474dc0c458c96881a.tar fosdem-2018-presentation-4a39aecbab17652b03bd863474dc0c458c96881a.tar.gz |
prevent repeated autoslidepaused/resumed events
-rw-r--r-- | js/reveal.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/js/reveal.js b/js/reveal.js index 8b7b158..cba8121 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -968,6 +968,8 @@ var Reveal = (function(){ */ function dispatchEvent( type, args ) { + console.log('event', type); + var event = document.createEvent( 'HTMLEvents', 1, 2 ); event.initEvent( type, true, true ); extend( event, args ); @@ -2747,21 +2749,25 @@ var Reveal = (function(){ function pauseAutoSlide() { - autoSlidePaused = true; - dispatchEvent( 'autoslidepaused' ); - clearTimeout( autoSlideTimeout ); + if( autoSlide && !autoSlidePaused ) { + autoSlidePaused = true; + dispatchEvent( 'autoslidepaused' ); + clearTimeout( autoSlideTimeout ); - if( autoSlidePlayer ) { - autoSlidePlayer.setPlaying( false ); + if( autoSlidePlayer ) { + autoSlidePlayer.setPlaying( false ); + } } } function resumeAutoSlide() { - autoSlidePaused = false; - dispatchEvent( 'autoslideresumed' ); - cueAutoSlide(); + if( autoSlide && autoSlidePaused ) { + autoSlidePaused = false; + dispatchEvent( 'autoslideresumed' ); + cueAutoSlide(); + } } |