From 46f8f86fa1d682e913459c13b5131f2baa25bcb5 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 1 Mar 2019 21:34:11 +0100 Subject: few plugin registration tweaks --- js/reveal.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'js') diff --git a/js/reveal.js b/js/reveal.js index 9b29f78..9da7f8f 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -519,24 +519,25 @@ if( typeof s.callback === 'function' ) s.callback(); if( --scriptsToLoad === 0 ) { - loadPlugins(); + initPlugins(); } } ); } ); } else { - loadPlugins(); + initPlugins(); } } /** - * Loads all plugins that require preloading. + * Initializes our plugins and waits for them to be ready + * before proceeding. */ - function loadPlugins() { + function initPlugins() { - var pluginsToLoad = Object.keys( plugins ).length; + var pluginsToInitialize = Object.keys( plugins ).length; for( var i in plugins ) { @@ -546,18 +547,18 @@ // wait for the callback if( typeof plugin.init === 'function' ) { plugin.init( function() { - if( --pluginsToLoad === 0 ) { + if( --pluginsToInitialize === 0 ) { loadAsyncDependencies(); } } ); } else { - pluginsToLoad -= 1; + pluginsToInitialize -= 1; } } - if( pluginsToLoad === 0 ) { + if( pluginsToInitialize === 0 ) { loadAsyncDependencies(); } @@ -5894,7 +5895,7 @@ addKeyBinding: addKeyBinding, removeKeyBinding: removeKeyBinding, - // Called by plugins to register/unregister themselves + // Called by plugins to register themselves registerPlugin: registerPlugin, // Programatically triggers a keyboard event -- cgit v1.2.3