incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject ios commit: updating JS to latest cordova-js drop
Date Wed, 28 Mar 2012 20:45:14 GMT
Updated Branches:
  refs/heads/master 122302934 -> c8be1dc72


updating JS to latest cordova-js drop


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

Branch: refs/heads/master
Commit: c8be1dc721fd9298a587c7201e750f381bfe3eb8
Parents: 1223029
Author: Fil Maj <maj.fil@gmail.com>
Authored: Wed Mar 28 13:45:59 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Wed Mar 28 13:45:59 2012 -0700

----------------------------------------------------------------------
 CordovaLib/javascript/cordova.ios.js |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/c8be1dc7/CordovaLib/javascript/cordova.ios.js
----------------------------------------------------------------------
diff --git a/CordovaLib/javascript/cordova.ios.js b/CordovaLib/javascript/cordova.ios.js
index 0d7262a..09c69ce 100644
--- a/CordovaLib/javascript/cordova.ios.js
+++ b/CordovaLib/javascript/cordova.ios.js
@@ -262,8 +262,9 @@ var cordova = {
             }
         }
     },
-    
+    // TODO: remove in 2.0.
     addPlugin: function(name, obj) {
+        console.log("[DEPRECATION NOTICE] window.addPlugin and window.plugins will be removed
in version 2.0.");
         if (!window.plugins[name]) {
             window.plugins[name] = obj;
         }
@@ -285,6 +286,7 @@ var cordova = {
 
 /** 
  * Legacy variable for plugin support
+ * TODO: remove in 2.0.
  */
 if (!window.PhoneGap) {
     window.PhoneGap = cordova;
@@ -292,6 +294,7 @@ if (!window.PhoneGap) {
 
 /**
  * Plugins object
+ * TODO: remove in 2.0.
  */
 if (!window.plugins) {
     window.plugins = {};
@@ -347,7 +350,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
+ '"');
         }
     });
 }
@@ -798,6 +801,7 @@ define("cordova/exec", function(require, exports, module) {
      * @private
      */
 var cordova = require('cordova'),
+    utils = require('cordova/utils'),
     gapBridge,
     createGapBridge = function() {
         gapBridge = document.createElement("iframe");
@@ -811,7 +815,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;
     }
@@ -3879,6 +3883,7 @@ define("cordova/plugin/ios/device", function(require, exports, module)
{
  * @constructor
  */
 var exec = require('cordova/exec'),
+    utils = require('cordova/utils'),
     channel = require('cordova/channel');
 
 var Device = function() {
@@ -3898,7 +3903,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!');
     }
 };
 
@@ -3990,7 +3995,7 @@ var NetworkConnection = function () {
  */
 NetworkConnection.prototype.getInfo = function (successCallback, errorCallback) {
     // Get info
-    exec(successCallback, errorCallback, "Network Status", "getConnectionInfo", []);
+    exec(successCallback, errorCallback, "NetworkStatus", "getConnectionInfo", []);
 };
 
 module.exports = new NetworkConnection();
@@ -4240,8 +4245,18 @@ var _self = {
             Child.__super__ = Parent.prototype;
             Child.prototype.constructor = Child;
         };
-    }())
+    }()),
 
+    /**
+     * Alerts a message in any available way: alert or console.log.
+     */
+    alert:function(msg) {
+        if (alert) {
+            alert(msg);
+        } else if (console && console.log) {
+            console.log(msg);
+        }
+    }
 };
 
 module.exports = _self;


Mime
View raw message