aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2019-03-14 15:39:19 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2019-03-14 15:39:19 +0100
commitb180d94e0227558de766af47b37d96693a942b60 (patch)
treec99ba9b06d9fc71669bf3943f24f2fd0d0837ef5
parent6410ed15aa5ce2bdfc1f7f02c818a562ec8a1fc4 (diff)
downloadperl-software-in-gnu-guix-b180d94e0227558de766af47b37d96693a942b60.tar
perl-software-in-gnu-guix-b180d94e0227558de766af47b37d96693a942b60.tar.gz
fix error when reveal.js was initialized with no plugins
-rw-r--r--js/reveal.js41
1 files changed, 25 insertions, 16 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 51b1ed0..387077a 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -539,30 +539,39 @@
var pluginsToInitialize = Object.keys( plugins ).length;
- var afterPlugInitialized = function() {
- if( --pluginsToInitialize === 0 ) {
- loadAsyncDependencies();
- }
- };
+ // If there are no plugins, skip this step
+ if( pluginsToInitialize === 0 ) {
+ loadAsyncDependencies();
+ }
+ // ... otherwise initialize plugins
+ else {
+
+ var afterPlugInitialized = function() {
+ if( --pluginsToInitialize === 0 ) {
+ loadAsyncDependencies();
+ }
+ };
- for( var i in plugins ) {
+ for( var i in plugins ) {
- var plugin = plugins[i];
+ var plugin = plugins[i];
- // If the plugin has an 'init' method, invoke it
- if( typeof plugin.init === 'function' ) {
- var callback = plugin.init();
+ // If the plugin has an 'init' method, invoke it
+ if( typeof plugin.init === 'function' ) {
+ var callback = plugin.init();
- // If the plugin returned a Promise, wait for it
- if( callback && typeof callback.then === 'function' ) {
- callback.then( afterPlugInitialized );
+ // If the plugin returned a Promise, wait for it
+ if( callback && typeof callback.then === 'function' ) {
+ callback.then( afterPlugInitialized );
+ }
+ else {
+ afterPlugInitialized();
+ }
}
else {
afterPlugInitialized();
}
- }
- else {
- afterPlugInitialized();
+
}
}