You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/03/26 02:38:44 UTC
git commit: [CB-364] woops,
implemented utils.log instead of utils.alert. switched that over.
also updated plugins that used alert to new utils.alert method
Updated Branches:
refs/heads/master 396b9faf3 -> c10b80eaf
[CB-364] woops, implemented utils.log instead of utils.alert. switched that over. also updated plugins that used alert to new utils.alert method
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/c10b80ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/c10b80ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/c10b80ea
Branch: refs/heads/master
Commit: c10b80eaf886a704fb144019bd869ea8962777bd
Parents: 396b9fa
Author: Fil Maj <ma...@gmail.com>
Authored: Sun Mar 25 17:39:17 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Sun Mar 25 17:39:17 2012 -0700
----------------------------------------------------------------------
lib/android/plugin/android/device.js | 4 ++--
lib/android/plugin/android/storage.js | 4 ++--
lib/blackberry/exec.js | 5 +++--
lib/common/builder.js | 2 +-
lib/common/utils.js | 10 +++++-----
lib/ios/exec.js | 3 ++-
lib/ios/plugin/ios/device.js | 3 ++-
lib/playbook/exec.js | 10 ++++++----
8 files changed, 23 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c10b80ea/lib/android/plugin/android/device.js
----------------------------------------------------------------------
diff --git a/lib/android/plugin/android/device.js b/lib/android/plugin/android/device.js
index 1defbbe..44a80c6 100644
--- a/lib/android/plugin/android/device.js
+++ b/lib/android/plugin/android/device.js
@@ -1,4 +1,5 @@
var channel = require('cordova/channel'),
+ utils = require('cordova/utils'),
exec = require('cordova/exec');
/**
@@ -27,8 +28,7 @@ function Device() {
},
function(e) {
me.available = false;
- console.log("Error initializing Cordova: " + e);
- alert("Error initializing Cordova: "+e);
+ utils.alert("[ERROR] Error initializing Cordova: " + e);
});
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c10b80ea/lib/android/plugin/android/storage.js
----------------------------------------------------------------------
diff --git a/lib/android/plugin/android/storage.js b/lib/android/plugin/android/storage.js
index 000612b..112f956 100644
--- a/lib/android/plugin/android/storage.js
+++ b/lib/android/plugin/android/storage.js
@@ -313,7 +313,7 @@ var CupcakeLocalStorage = function() {
},
function (err) {
- alert(err.message);
+ utils.alert(err.message);
}
);
this.setItem = function(key, val) {
@@ -364,7 +364,7 @@ var CupcakeLocalStorage = function() {
};
} catch(e) {
- alert("Database error "+e+".");
+ utils.alert("Database error "+e+".");
return;
}
};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c10b80ea/lib/blackberry/exec.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/exec.js b/lib/blackberry/exec.js
index a5fb81f..ef59d2f 100644
--- a/lib/blackberry/exec.js
+++ b/lib/blackberry/exec.js
@@ -13,7 +13,8 @@
* @param {String[]} [args] Zero or more arguments to pass to the method
*/
var blackberry = require('cordova/plugin/blackberry/manager'),
- cordova = require('cordova');
+ cordova = require('cordova'),
+ utils = require('cordova/utils');
module.exports = function(success, fail, service, action, args) {
try {
@@ -51,6 +52,6 @@ module.exports = function(success, fail, service, action, args) {
return null;
}
} catch (e) {
- alert("Error: "+e);
+ utils.alert("Error: "+e);
}
};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c10b80ea/lib/common/builder.js
----------------------------------------------------------------------
diff --git a/lib/common/builder.js b/lib/common/builder.js
index 0ff2f73..4c46cee 100644
--- a/lib/common/builder.js
+++ b/lib/common/builder.js
@@ -42,7 +42,7 @@ function include(parent, objects, clobber, merge) {
include(result, obj.children, clobber, merge);
}
} catch(e) {
- alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
+ utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
}
});
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c10b80ea/lib/common/utils.js
----------------------------------------------------------------------
diff --git a/lib/common/utils.js b/lib/common/utils.js
index 30a41d8..800ace1 100644
--- a/lib/common/utils.js
+++ b/lib/common/utils.js
@@ -90,13 +90,13 @@ var _self = {
}()),
/**
- * Logs a message in any available way: console.log or alert.
+ * Alerts a message in any available way: alert or console.log.
*/
- log:function(msg) {
- if (console && console.log) {
- console.log(msg);
- } else if (alert) {
+ alert:function(msg) {
+ if (alert) {
alert(msg);
+ } else if (console && console.log) {
+ console.log(msg);
}
}
};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c10b80ea/lib/ios/exec.js
----------------------------------------------------------------------
diff --git a/lib/ios/exec.js b/lib/ios/exec.js
index 32d8b6a..4501b01 100644
--- a/lib/ios/exec.js
+++ b/lib/ios/exec.js
@@ -5,6 +5,7 @@
* @private
*/
var cordova = require('cordova'),
+ utils = require('cordova/utils'),
gapBridge,
createGapBridge = function() {
gapBridge = document.createElement("iframe");
@@ -18,7 +19,7 @@ var cordova = require('cordova'),
module.exports = function() {
if (!channel.onCordovaInfoReady.fired) {
- alert("ERROR: Attempting to call cordova.exec()" +
+ utils.alert("ERROR: Attempting to call cordova.exec()" +
" before 'deviceready'. Ignoring.");
return;
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c10b80ea/lib/ios/plugin/ios/device.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/device.js b/lib/ios/plugin/ios/device.js
index c6d117b..4ab6382 100644
--- a/lib/ios/plugin/ios/device.js
+++ b/lib/ios/plugin/ios/device.js
@@ -4,6 +4,7 @@
* @constructor
*/
var exec = require('cordova/exec'),
+ utils = require('cordova/utils'),
channel = require('cordova/channel');
var Device = function() {
@@ -23,7 +24,7 @@ Device.prototype.setInfo = function(info) {
this.uuid = info.uuid;
channel.onCordovaInfoReady.fire();
} catch(e) {
- alert('Error during device info setting in cordova/plugin/ios/device!');
+ utils.alert('Error during device info setting in cordova/plugin/ios/device!');
}
};
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c10b80ea/lib/playbook/exec.js
----------------------------------------------------------------------
diff --git a/lib/playbook/exec.js b/lib/playbook/exec.js
index ff2cbd9..756d305 100644
--- a/lib/playbook/exec.js
+++ b/lib/playbook/exec.js
@@ -1,3 +1,7 @@
+var playbook = require('cordova/plugin/playbook/manager'),
+ cordova = require('cordova'),
+ utils = require('cordova/utils');
+
/**
* Execute a cordova command. It is up to the native side whether this action
* is synchronous or asynchronous. The native side can return:
@@ -15,9 +19,7 @@
module.exports = function(success, fail, service, action, args) {
try {
- var playbook = require('cordova/plugin/playbook/manager'),
- cordova = require('cordova'),
- v = playbook.exec(success, fail, service, action, args);
+ var v = playbook.exec(success, fail, service, action, args);
// If status is OK, then return value back to caller
if (v.status == cordova.callbackStatus.OK) {
@@ -51,6 +53,6 @@ module.exports = function(success, fail, service, action, args) {
return null;
}
} catch (e) {
- alert("Error: "+e);
+ utils.alert("Error: "+e);
}
};