1
0
mirror of https://github.com/hakimel/reveal.js.git synced 2025-07-30 19:30:22 +02:00

only destroy if reveal instance is ready, don't proceed with initialization after destroy is called, tests #3593

This commit is contained in:
Hakim El Hattab
2024-05-15 11:15:21 +02:00
parent 7cab93baab
commit 472535065c
6 changed files with 109 additions and 7 deletions

View File

@@ -190,6 +190,9 @@ export default function( revealElement, options ) {
*/
function start() {
// Don't proceed if this instance has been destroyed
if( initialized === false ) return;
ready = true;
// Remove slides hidden with data-visibility
@@ -609,9 +612,11 @@ export default function( revealElement, options ) {
*/
function destroy() {
// There's nothing to destroy if this instance hasn't been
// initialized yet
if( initialized === false ) return;
initialized = false;
// There's nothing to destroy if this instance hasn't finished
// initializing
if( ready === false ) return;
removeEventListeners();
cancelAutoSlide();