diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2019-03-04 14:11:21 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2019-03-04 14:11:21 +0100 |
commit | d780352b7f78e16635ce9fabf2dbb53639610f18 (patch) | |
tree | 7c1cfa30946071779d65819a4c43bbace1cd7942 /js | |
parent | 46f8f86fa1d682e913459c13b5131f2baa25bcb5 (diff) | |
download | perl-software-in-gnu-guix-d780352b7f78e16635ce9fabf2dbb53639610f18.tar perl-software-in-gnu-guix-d780352b7f78e16635ce9fabf2dbb53639610f18.tar.gz |
reveal.js plugin flow now uses promises, refactor markdown plugin to use promises
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 17 |
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 ); |