aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2019-04-01 15:11:51 +0200
committerGitHub <noreply@github.com>2019-04-01 15:11:51 +0200
commit25c504c22f0a48e4a63ee3c52e06346db54de7e2 (patch)
tree714cead836fdca6585835ecb872fcc4f93cef728
parent3da09f1fef1fa3c140d2daa5bdee2a32683dd964 (diff)
downloadperl-software-in-gnu-guix-25c504c22f0a48e4a63ee3c52e06346db54de7e2.tar
perl-software-in-gnu-guix-25c504c22f0a48e4a63ee3c52e06346db54de7e2.tar.gz
plugin api docs
-rw-r--r--README.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/README.md b/README.md
index e5a1911..4ba9bd1 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,7 @@ reveal.js comes with a broad range of features including [nested slides](https:/
- [Speaker Notes](#speaker-notes)
- [Share and Print Speaker Notes](#share-and-print-speaker-notes)
- [Server Side Speaker Notes](#server-side-speaker-notes)
+- [Plugins](#plugins)
- [Multiplexing](#multiplexing)
- [Master presentation](#master-presentation)
- [Client presentation](#client-presentation)
@@ -1205,6 +1206,29 @@ Then:
3. Run `node plugin/notes-server`
+## Plugins
+
+Plugins should be registered with reveal.js by calling `Reveal.registerPlugin( 'myPluginID', MyPlugin )`. Registered plugin instances should expose an "init" function that reveal.js can call to initialize them.
+
+When reveal.js is booted up via `Reveal.initialize()`, it will go through all registered plugins and invoke their "init" methods. If the "init" method returns a Promise, reveal.js will wait for that promise to be fullfilled before finshing the startup sequence and firing the [ready](#ready-event) event. Here's an example of a plugin that returns a promise:
+
+```
+Reveal.registerPlugin( 'myPlugin', {
+ init: () => {
+ return new Promise( resolve => setTimeout( resolve, 3000 ) );
+ }
+} );
+Reveal.addEventListener( 'ready', () => console.log( 'Three seconds later...' ) );
+Reveal.initialize();
+```
+
+If the init method does _not_ return a Promise, it is considered ready right away and will not hold up the reveal.js startup sequence.
+
+### Retrieving Plugins
+
+If you want to check if a specific plugin is registered you can use the `Reveal.hasPlugin` method and pass in a plugin ID, for example: `Reveal.hasPlugin( 'myPlugin' )`. If you want to retrieve a plugin instance you can use `Reveal.getPlugin( 'myPlugin' )`.
+
+
## Multiplexing
The multiplex plugin allows your audience to view the slides of the presentation you are controlling on their own phone, tablet or laptop. As the master presentation navigates the slides, all client presentations will update in real time. See a demo at [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/).