Skip to content
Snippets Groups Projects
Commit c7c09644 authored by Hakim El Hattab's avatar Hakim El Hattab
Browse files

esm readme tweak

parent b61a6a6f
No related branches found
No related tags found
No related merge requests found
......@@ -189,10 +189,9 @@ Here's how to import and initialize the ES module version of reveal.js, includin
```html
<script type="module">
import Reveal from '/dist/reveal.js';
import markdown from '/plugin/markdown/markdown.js';
import Markdown from '/plugin/markdown/markdown.js';
Reveal.initialize({
keyboard: true,
plugins: [ markdown() ]
plugins: [ Markdown ]
});
</script>
```
......@@ -625,6 +624,8 @@ loaded when they become visible.
### Plugins
**Outdated, this will be rewritten to match the 4.0 plugin API**
Plugins should register themselves with reveal.js by calling `Reveal.registerPlugin( MyPlugin )`. Registered plugins _must_ expose a unique `id` property and can optionally expose an `init` function that reveal.js will call to initialize them.
When reveal.js is booted up via `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 fulfilled before finishing the startup sequence and firing the [ready](#ready-event) event. Here’s an example of a plugin that does some asynchronous work before reveal.js can proceed:
......@@ -643,11 +644,15 @@ Reveal.initialize({
} );
```
Note that reveal.js will *not* wait for init Promise fulfillment if the plugin is loaded as an [async dependency](#dependencies). If the plugin’s init method does _not_ return a Promise, the plugin is considered ready right away and will not hold up the reveal.js startup sequence.
If the plugin’s init method does _not_ return a Promise, the plugin is considered ready right away and will not hold up the reveal.js startup sequence.
### Manually Registering Plugins
TBD. Describe how plugins can be registered after reveal.js is already initialized.
### 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’ )`.
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( ’my-plugin’ )`. If you want to retrieve a plugin instance you can use `Reveal.getPlugin( ’my-plugin’ )`.
### Dependencies
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment