Skip to content

Commit

Permalink
prevent same plugin from being registered twice
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Mar 12, 2019
1 parent fbbae1d commit 7b62a0f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}

}
Expand Down

0 comments on commit 7b62a0f

Please sign in to comment.