aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 9da7f8f..f408048 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -546,7 +546,7 @@
// If the plugin has an 'init' method, initialize and
// wait for the callback
if( typeof plugin.init === 'function' ) {
- plugin.init( function() {
+ plugin.init().then( function() {
if( --pluginsToInitialize === 0 ) {
loadAsyncDependencies();
}
@@ -1551,11 +1551,21 @@
/**
* Registers a new plugin with this reveal.js instance.
+ *
+ * reveal.js waits for all regisered plugins to initialize
+ * before considering itself ready, as long as the plugin
+ * is registered before calling `Reveal.initialize()`.
*/
function registerPlugin( id, plugin ) {
plugins[id] = plugin;
+ // If a plugin is registered after reveal.js is loaded,
+ // initialize it right away
+ if( loaded && typeof plugin.init === 'function' ) {
+ plugin.init();
+ }
+
}
/**
@@ -5841,6 +5851,11 @@
return dom.wrapper || document.querySelector( '.reveal' );
},
+ // Returns a hash with all registered plugins
+ getPlugins: function() {
+ return plugins;
+ },
+
// Returns true if we're currently on the first slide
isFirstSlide: function() {
return ( indexh === 0 && indexv === 0 );