From 9a2160536d8f657e3249f010989a3e0f6b6be002 Mon Sep 17 00:00:00 2001
From: Hakim El Hattab <hakim.elhattab@gmail.com>
Date: Tue, 10 Mar 2020 10:18:37 +0100
Subject: [PATCH] tweaks and updated docs for #2627

---
 README.md                 |  9 +++------
 js/controllers/plugins.js | 22 ++++++++++++----------
 js/utils/device.js        |  2 +-
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/README.md b/README.md
index f45e004b..1a25a389 100644
--- a/README.md
+++ b/README.md
@@ -522,12 +522,9 @@ You can add your own extensions using the same syntax. The following properties
 - **callback**: [optional] Function to execute when the script has loaded
 - **condition**: [optional] Function which must return true for the script to be loaded
 
-You can additionally use the following syntax, in case you are using a bundler:
-- **id**: the id of the plugin to load
-- **plugin**: the plugin object to load. It is the plugin implementation that can contain an `init` function
-- **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false
-- **callback**: [optional] Function to execute when the script has loaded
-- **condition**: [optional] Function which must return true for the script to be loaded
+You can also include dependencies which are bundled/already present on the page. To include a bundled plugin. replace the `src` property with a plugin `id` and a reference to the `plugin` instance:
+- **id**: the id of the plugin
+- **plugin**: the plugin instance (see [Plugins](#plugins))
 
 ### Ready Event
 
diff --git a/js/controllers/plugins.js b/js/controllers/plugins.js
index 00b0c5e6..af578cce 100644
--- a/js/controllers/plugins.js
+++ b/js/controllers/plugins.js
@@ -58,11 +58,12 @@ export default class Plugins {
 
 				// Load synchronous scripts
 				scripts.forEach( s => {
-					if (s.id) {
-						this.registerPlugin(s.id, s.plugin);
-						scriptLoadedCallback(s);
-					} else {
-						loadScript( s.src, () => scriptLoadedCallback(s));
+					if( s.id ) {
+						this.registerPlugin( s.id, s.plugin );
+						scriptLoadedCallback( s );
+					}
+					else {
+						loadScript( s.src, () => scriptLoadedCallback(s) );
 					}
 				} );
 			}
@@ -134,11 +135,12 @@ export default class Plugins {
 
 		if( this.asyncDependencies.length ) {
 			this.asyncDependencies.forEach( s => {
-				if (s.id) {
-					this.registerPlugin(s.id, s.plugin);
-					if (typeof s.plugin.init === 'function') { s.plugin.init(); }
-					if (typeof s.callback === 'function') { s.callback(); }
-				} else {
+				if( s.id ) {
+					this.registerPlugin( s.id, s.plugin );
+					if( typeof s.plugin.init === 'function' ) s.plugin.init();
+					if( typeof s.callback === 'function' ) s.callback();
+				}
+				else {
 					loadScript( s.src, s.callback );
 				}
 			} );
diff --git a/js/utils/device.js b/js/utils/device.js
index c6b4095b..ec1034f0 100644
--- a/js/utils/device.js
+++ b/js/utils/device.js
@@ -10,6 +10,6 @@ export const isAndroid = /android/gi.test( UA );
 
 // Flags if we should use zoom instead of transform to scale
 // up slides. Zoom produces crisper results but has a lot of
-// xbrowser quirks so we only use it in whitelsited browsers.
+// xbrowser quirks so we only use it in whitelisted browsers.
 export const supportsZoom = 'zoom' in testElement.style && !isMobile &&
 				( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) );
\ No newline at end of file
-- 
GitLab