Replies: 3 comments 1 reply
-
Good feedback thanks. I'd love to make this more streamlined. Plugins are currently loaded and initialized serially in the order they appear in the plugins array. For example the following will wait for Reveal.initialize({
plugins: [
RevealMarkdown,
RevealHighlight,
PluginThatRequiresMarkdownAndHighlight
]
}).then(() => {}); To make this more flexible maybe we can introduce a const PluginA = {
id: 'plugin-a',
requires: [ 'plugin-c' ],
init: () => () // initialized after PluginC
}
const PluginB = {
id: 'plugin-b',
init: () => () // initialized immediately without waiting
}
const PluginC = {
id: 'plugin-c',
requires: [ 'markdown' ],
init: () => () // initialized after RevealMarkdown
}
Reveal.initialize({
plugins: [ PluginA, PluginB, PluginC, RevealMarkdown ]
}); |
Beta Was this translation helpful? Give feedback.
-
Hi Asvin, good idea to start this discussion. I had the same problems with some of my plugins: need to tell the user in what order to load the dependency plugins. Hakim, your idea could solve that indeed! Order of plugins is then no longer important. |
Beta Was this translation helpful? Give feedback.
-
In my opinion, the plugins should not need to know much about each other. This is important as it would help the interplay of plugins from different developers. For synchronous plugins the current approach is perfectly fine in my opinion:
However, if plugins are asynchronous, there are potential problems: Use case 1 Use case 2 Use case 3 Concludingly, the dependencies may depend on the use case. Therefore, it should be the responsibility of the user to ensure that plugin dependencies of the use case are met and the plugin creator should only care about the core functionality of the plugin. The possibility to chain promises of plugins and adding plugins after other asynchronous plugins have completed could be a solution. If |
Beta Was this translation helpful? Give feedback.
-
Some plugin functionality can only be realised after other plugins have completed their job. For example, the menu-plugin requires that the markdown plugin has created all the slides. In general, there are many use cases where some plugins load dynamic content, and others work on formatting the dynamically generated content.
When initializing we can use promises, to execute stuff after plugins have completed their job, but currently it is not possible to chain this functionality as
Reveal.registerPlugin
doesn't use promises.The menu plugin and some of my plugins use a work around specifcally for the markdown-plugin like this:
Obviously, this is a hack and not a clean solution. It would be really nice if one could do something like this:
This way inter-plugin dependencies could be cleanly considered.
Beta Was this translation helpful? Give feedback.
All reactions