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/07/14 01:03:34 UTC

js commit: [CB-388] REMOVED "PhoneGap" and "Cordova" JavaScript globals - have been deprecated and slated for removal in 2.0 since 1.4.

Updated Branches:
  refs/heads/master fd00bff18 -> 3d0790c87


[CB-388] REMOVED "PhoneGap" and "Cordova" JavaScript globals - have been deprecated and slated for removal in 2.0 since 1.4.


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

Branch: refs/heads/master
Commit: 3d0790c8707ec09711c4a8f06f4cf5b796afef9a
Parents: fd00bff
Author: Fil Maj <ma...@gmail.com>
Authored: Fri Jul 13 16:05:56 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Fri Jul 13 16:05:56 2012 -0700

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


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/3d0790c8/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 596e83b..dbaf478 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -218,17 +218,6 @@ 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;
-        }
-        else {
-            console.log("Error: Plugin "+name+" already exists.");
-        }
-    },
-
     addConstructor: function(func) {
         channel.onCordovaReady.subscribeOnce(function() {
             try {
@@ -245,49 +234,4 @@ channel.onPause = cordova.addDocumentEventHandler('pause');
 channel.onResume = cordova.addDocumentEventHandler('resume');
 channel.onDeviceReady = cordova.addDocumentEventHandler('deviceready');
 
-// Adds deprecation warnings to functions of an object (but only logs a message once)
-function deprecateFunctions(obj, objLabel) {
-    var newObj = {};
-    var logHash = {};
-    for (var i in obj) {
-        if (obj.hasOwnProperty(i)) {
-            if (typeof obj[i] == 'function') {
-                newObj[i] = (function(prop){
-                    var oldFunk = obj[prop];
-                    var funkId = objLabel + '_' + prop;
-                    return function() {
-                        if (!logHash[funkId]) {
-                            console.log('[DEPRECATION NOTICE] The "' + objLabel + '" global will be removed in version 2.0, please use lowercase "cordova".');
-                            logHash[funkId] = true;
-                        }
-                        oldFunk.apply(obj, arguments);
-                    };
-                })(i);
-            } else {
-                newObj[i] = (function(prop) { return obj[prop]; })(i);
-            }
-        }
-    }
-    return newObj;
-}
-
-/**
- * Legacy variable for plugin support
- * TODO: remove in 2.0.
- */
-if (!window.PhoneGap) {
-    window.PhoneGap = deprecateFunctions(cordova, 'PhoneGap');
-}
-if (!window.Cordova) {
-    window.Cordova = deprecateFunctions(cordova, 'Cordova');
-}
-
-/**
- * Plugins object
- * TODO: remove in 2.0.
- */
-if (!window.plugins) {
-    window.plugins = {};
-}
-
 module.exports = cordova;