cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [1/3] js commit: Testing non-xhr loader with Fil
Date Wed, 19 Jun 2013 21:21:11 GMT
Updated Branches:
  refs/heads/2.9.x 11df4b7cb -> e2020c3c4
Updated Tags:  refs/tags/2.9.0rc1 11df4b7cb -> e2020c3c4


Testing non-xhr loader with Fil


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

Branch: refs/heads/2.9.x
Commit: ce87a15b4161197348ebbb2284885d922e764c31
Parents: 11df4b7
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Fri May 17 17:35:46 2013 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Wed Jun 19 14:20:32 2013 -0700

----------------------------------------------------------------------
 lib/scripts/plugin_loader.js | 57 +++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/ce87a15b/lib/scripts/plugin_loader.js
----------------------------------------------------------------------
diff --git a/lib/scripts/plugin_loader.js b/lib/scripts/plugin_loader.js
index 892bd76..1a38eda 100644
--- a/lib/scripts/plugin_loader.js
+++ b/lib/scripts/plugin_loader.js
@@ -103,30 +103,41 @@
             break;
         }
     }
-    // Try to XHR the cordova_plugins.json file asynchronously.
-    var xhr = new XMLHttpRequest();
-    xhr.onload = function() {
-        // If the response is a JSON string which composes an array, call handlePluginsObject.
-        // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
-        var obj;
-        try {
-            obj = (this.status == 0 || this.status == 200) && this.responseText &&
JSON.parse(this.responseText);
-        } catch (err) {
-            // obj will be undefined.
-        }
-        if (Array.isArray(obj) && obj.length > 0) {
-            handlePluginsObject(obj, path);
-        } else {
-            finishPluginLoading();
-        }
-    };
-    xhr.onerror = function() {
-        finishPluginLoading();
-    };
-    var plugins_json = path + 'cordova_plugins.json';
+
+    // // Try to XHR the cordova_plugins.json file asynchronously.
+    // var xhr = new XMLHttpRequest();
+    // xhr.onload = function() {
+    //     // If the response is a JSON string which composes an array, call handlePluginsObject.
+    //     // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
+    //     var obj;
+    //     try {
+    //         obj = (this.status == 0 || this.status == 200) && this.responseText
&& JSON.parse(this.responseText);
+    //     } catch (err) {
+    //         // obj will be undefined.
+    //     }
+    //     if (Array.isArray(obj) && obj.length > 0) {
+    //         handlePluginsObject(obj, path);
+    //     } else {
+    //         finishPluginLoading();
+    //     }
+    // };
+    // xhr.onerror = function() {
+    //     finishPluginLoading();
+    // };
+
+    var plugins_js = path + 'cordova_plugins.js';
     try { // we commented we were going to try, so let us actually try and catch
-        xhr.open('GET', plugins_json, true); // Async
-        xhr.send();
+        //xhr.open('GET', plugins_json, true); // Async
+        //xhr.send();
+        var script = document.createElement("script");
+        script.onload = function(){
+            var list = cordova.require("cordova/plugin_list");
+            handlePluginsObject(list,path);
+
+        };
+        script.src = plugins_js;
+        document.head.appendChild(script);
+
     } catch(err){
         finishPluginLoading();
     }


Mime
View raw message