cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [09/34] js commit: CB-5671 setTimeout to allow concat'ed JS to load before pluginLoader.load()
Date Thu, 27 Mar 2014 14:22:18 GMT
CB-5671 setTimeout to allow concat'ed JS to load before pluginLoader.load()


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/2c375dd4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/2c375dd4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/2c375dd4

Branch: refs/heads/browserify
Commit: 2c375dd4f585b3fb29ff67ec455918c3a333fc7a
Parents: 5f811bb
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Mon Feb 24 21:04:02 2014 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Feb 24 21:04:02 2014 -0500

----------------------------------------------------------------------
 src/common/init.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2c375dd4/src/common/init.js
----------------------------------------------------------------------
diff --git a/src/common/init.js b/src/common/init.js
index 65c6380..4f4882c 100644
--- a/src/common/init.js
+++ b/src/common/init.js
@@ -103,9 +103,13 @@ modulemapper.clobbers('cordova/exec', 'Cordova.exec');
 // Call the platform-specific initialization.
 platform.bootstrap && platform.bootstrap();
 
-pluginloader.load(function() {
-    channel.onPluginsReady.fire();
-});
+// Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
+// The delay allows the attached modules to be defined before the plugin loader looks for
them.
+setTimeout(function() {
+    pluginloader.load(function() {
+        channel.onPluginsReady.fire();
+    });
+}, 0);
 
 /**
  * Create all cordova objects once native side is ready.


Mime
View raw message