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/12 22:31:40 UTC

[1/6] js commit: [CB-1013] Removed WP7-specific device module, common will do the trick.

Updated Branches:
  refs/heads/master df936f604 -> 32e35b75c


[CB-1013] Removed WP7-specific device module, common will do the trick.


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

Branch: refs/heads/master
Commit: 32e35b75c5ea2946dffebbc6cf4d0fbc16c0839e
Parents: 738f9d3
Author: Fil Maj <ma...@gmail.com>
Authored: Thu Jul 12 13:32:19 2012 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Thu Jul 12 13:32:19 2012 -0700

----------------------------------------------------------------------
 lib/wp7/platform.js          |   35 +++++++++------------
 lib/wp7/plugin/wp7/device.js |   60 -------------------------------------
 2 files changed, 15 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/32e35b75/lib/wp7/platform.js
----------------------------------------------------------------------
diff --git a/lib/wp7/platform.js b/lib/wp7/platform.js
index 0bac7f7..0636d2b 100644
--- a/lib/wp7/platform.js
+++ b/lib/wp7/platform.js
@@ -13,22 +13,21 @@ require("cordova/plugin/wp7/XHRPatch");
 module.exports = {
     id: "wp7",
     initialize:function() {
+        window.alert = require("cordova/plugin/notification").alert;
 
-    window.alert = require("cordova/plugin/notification").alert;
-
-    // INject a lsitener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners
-    var backButtonChannel = cordova.addDocumentEventHandler('backbutton', {
-      onSubscribe:function() {
-        if (this.numHandlers === 1) {
-            exec(null, null, "CoreEvents", "overridebackbutton", [true]);
-        }
-      },
-      onUnsubscribe:function() {
-        if (this.numHandlers === 0) {
-          exec(null, null, "CoreEvents", "overridebackbutton", [false]);
-        }
-      }
-    });
+        // Inject a listener for the backbutton, and tell native to override the flag (true/false) when we have 1 or more, or 0, listeners
+        var backButtonChannel = cordova.addDocumentEventHandler('backbutton', {
+          onSubscribe:function() {
+            if (this.numHandlers === 1) {
+                exec(null, null, "CoreEvents", "overridebackbutton", [true]);
+            }
+          },
+          onUnsubscribe:function() {
+            if (this.numHandlers === 0) {
+              exec(null, null, "CoreEvents", "overridebackbutton", [false]);
+            }
+          }
+        });
     },
     objects: {
         CordovaCommandResult: {
@@ -40,7 +39,6 @@ module.exports = {
         navigator: {
             children: {
                 device: {
-                    path: "cordova/plugin/wp7/device",
                     children:{
                         capture:{
                             path:"cordova/plugin/capture"
@@ -53,9 +51,6 @@ module.exports = {
                 }
             }
         },
-        device:{
-          path:"cordova/plugin/wp7/device"
-        },
         console:{
           path: "cordova/plugin/wp7/console"
         },
@@ -63,4 +58,4 @@ module.exports = {
             path: 'cordova/plugin/wp7/FileTransfer'
         }
     }
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/32e35b75/lib/wp7/plugin/wp7/device.js
----------------------------------------------------------------------
diff --git a/lib/wp7/plugin/wp7/device.js b/lib/wp7/plugin/wp7/device.js
deleted file mode 100644
index ebb85ee..0000000
--- a/lib/wp7/plugin/wp7/device.js
+++ /dev/null
@@ -1,60 +0,0 @@
-var channel = require('cordova/channel'),
-    utils = require('cordova/utils'),
-    exec = require('cordova/exec');
-
-/**
- * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the
- * phone, etc.
- * @constructor
- */
-function Device() {
-    this.available = false;
-    this.platform = null;
-    this.version = null;
-    this.name = null;
-    this.uuid = null;
-    this.cordova = null;
-
-    var me = this;
-
-    channel.onCordovaReady.subscribeOnce(function() {
-        me.getInfo(function(info) {
-            me.available = true;
-            me.platform = info.platform;
-            me.version = info.version;
-            me.name = info.name;
-            me.uuid = info.uuid;
-            me.cordova = info.cordova;
-            channel.onCordovaInfoReady.fire();
-        },function(e) {
-            me.available = false;
-            utils.alert("[ERROR] Error initializing Cordova: " + e);
-        });
-    });
-}
-
-/**
- * Get device info
- *
- * @param {Function} successCallback The function to call when the heading data is available
- * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL)
- */
-Device.prototype.getInfo = function(successCallback, errorCallback) {
-
-    // successCallback required
-    if (typeof successCallback !== "function") {
-        console.log("Device Error: successCallback is not a function");
-        return;
-    }
-
-    // errorCallback optional
-    if (errorCallback && (typeof errorCallback !== "function")) {
-        console.log("Device Error: errorCallback is not a function");
-        return;
-    }
-
-    // Get info
-    exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
-};
-
-module.exports = new Device();
\ No newline at end of file