incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [2/2] git commit: [CB-298] added deprecation notices for window.plugins and PhoneGap globals
Date Tue, 27 Mar 2012 00:40:04 GMT
[CB-298] added deprecation notices for window.plugins and PhoneGap globals


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/28e1f434
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/28e1f434
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/28e1f434

Branch: refs/heads/master
Commit: 28e1f4346e8594d36ce1311e227b92d4dd53203f
Parents: c10b80e
Author: Fil Maj <maj.fil@gmail.com>
Authored: Sun Mar 25 17:59:13 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Sun Mar 25 17:59:13 2012 -0700

----------------------------------------------------------------------
 lib/cordova.js |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/28e1f434/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 3d5b2a5..f3ede6d 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -196,6 +196,7 @@ var cordova = {
     },
     
     addPlugin: function(name, obj) {
+        console.log("[DEPRECATION NOTICE] window.addPlugins and window.plugins will be removed
in v1.7.");
         if (!window.plugins[name]) {
             window.plugins[name] = obj;
         }
@@ -217,13 +218,28 @@ var cordova = {
 
 /** 
  * Legacy variable for plugin support
+ * TODO: remove in 1.7.
  */
 if (!window.PhoneGap) {
-    window.PhoneGap = cordova;
+    window.PhoneGap = {};
+    for (var i in cordova) {
+        if (cordova.hasOwnProperty(i)) {
+            window.PhoneGap[i] = (function() {
+                return (typeof cordova[i] == 'function' ?
+                        function() {
+                            console.log("[DEPRECATION NOTICE] window.PhoneGap will be removed
in v.1.7.");
+                            cordova[i].apply(cordova, arguments);
+                        } : 
+                        cordova[i]
+                       );
+            })();
+        }
+    }
 }
 
 /**
  * Plugins object
+ * TODO: remove in 1.7.
  */
 if (!window.plugins) {
     window.plugins = {};


Mime
View raw message