aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2019-03-12 13:17:08 +0100
committerHakim El Hattab <hakim.elhattab@gmail.com>2019-03-12 13:17:08 +0100
commit7b62a0f3566bf788fc14ba51e5b6e0e8cc34b637 (patch)
treea901c626028b6e7a2e9021110665c68dd180b8fa
parentfbbae1dc55134d014a5a0df2e800d711e087b48f (diff)
downloadperl-software-in-gnu-guix-7b62a0f3566bf788fc14ba51e5b6e0e8cc34b637.tar
perl-software-in-gnu-guix-7b62a0f3566bf788fc14ba51e5b6e0e8cc34b637.tar.gz
prevent same plugin from being registered twice
-rw-r--r--js/reveal.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 616a935..1ef10aa 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -1558,12 +1558,17 @@
*/
function registerPlugin( id, plugin ) {
- plugins[id] = plugin;
+ if( plugins[id] === undefined ) {
+ 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();
+ // If a plugin is registered after reveal.js is loaded,
+ // initialize it right away
+ if( loaded && typeof plugin.init === 'function' ) {
+ plugin.init();
+ }
+ }
+ else {
+ console.warn( 'reveal.js: "'+ id +'" plugin has already been registered' );
}
}