You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/06/28 16:15:28 UTC
[04/26] js commit: Testing non-xhr loader with Fil
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/bd4cff03
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/bd4cff03
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/bd4cff03
Branch: refs/heads/2.9.x
Commit: bd4cff03efc1cf11c812b05835dd74853f5e68cc
Parents: 0f10e3a
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri May 17 17:35:46 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Jun 19 13:32:07 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/bd4cff03/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();
}