You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/11/06 01:38:28 UTC

[8/25] js commit: linting and hinting

linting and hinting


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

Branch: refs/heads/master
Commit: 6f0db2731cba1fd216daeaa88288a093e2b7f50c
Parents: 6805a3a
Author: purplecabbage <pu...@gmail.com>
Authored: Wed Oct 31 15:14:35 2012 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Wed Oct 31 15:14:35 2012 -0700

----------------------------------------------------------------------
 lib/windows8/plugin/windows8/ContactsProxy.js |   11 +++++------
 lib/windows8/plugin/windows8/DeviceProxy.js   |   18 +++++++++---------
 lib/windows8/plugin/windows8/MediaProxy.js    |    9 +++++----
 3 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/6f0db273/lib/windows8/plugin/windows8/ContactsProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/ContactsProxy.js b/lib/windows8/plugin/windows8/ContactsProxy.js
index 41a1f32..629dbca 100644
--- a/lib/windows8/plugin/windows8/ContactsProxy.js
+++ b/lib/windows8/plugin/windows8/ContactsProxy.js
@@ -34,13 +34,12 @@ module.exports = {
         if (options.multiple) {
             picker.pickMultipleContactsAsync().then(function (contacts) {
                 win(contacts);
-            })
-        } else {
+            });
+        }
+        else {
             picker.pickSingleContactAsync().then(function (contact) {
-                var result = new Array();
-                result.push(contact);
-                win(result);
-            })
+                win([contact]);
+            });
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/6f0db273/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
index 98d3ff0..5c04bec 100644
--- a/lib/windows8/plugin/windows8/DeviceProxy.js
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -21,12 +21,13 @@
 
 var cordova = require('cordova');
 var utils = require('cordova/utils');
+var FileError = require('cordova/plugin/FileError');
 
 
 module.exports = {
 
         getDeviceInfo:function(win,fail,args){
-            console.log("NativeProxy::getDeviceInfo");
+            //console.log("NativeProxy::getDeviceInfo");
 
             var hostNames = Windows.Networking.Connectivity.NetworkInformation.getHostNames();
 
@@ -52,18 +53,19 @@ module.exports = {
                             deviceId = fileContent;
                             setTimeout(function () {
                                 win({ platform: "windows8", version: "8", name: name, uuid: deviceId, cordova: "2.2.0" });
-                            }, 0)
+                            }, 0);
                         } else {
                             deviceId = utils.createUUID();
-                            Windows.Storage.FileIO.writeTextAsync(storageFile, deviceId, Windows.Storage.Streams.UnicodeEncoding.utf8).done(
+                            var fileIO = Windows.Storage.FileIO;
+                            fileIO.writeTextAsync(storageFile, deviceId, Windows.Storage.Streams.UnicodeEncoding.utf8).done(
                                 function () {
                                     setTimeout(function () {
                                         win({ platform: "windows8", version: "8", name: name, uuid: deviceId, cordova: "2.2.0" });
-                                    }, 0)
-                                }, function () {
+                                    }, 0);
+                                },
+                                function () {
                                     fail(FileError.INVALID_MODIFICATION_ERR);
                                 }
-
                             );
                         }
                     },
@@ -74,11 +76,9 @@ module.exports = {
                     fail(FileError.NOT_FOUND_ERR);
                 });
                 
-            }, 
+            },
             fail && fail());
 
-        }
-
         setTimeout(function(){
             win({platform:"windows8", version:"8", name:name, uuid:deviceId, cordova:"2.2.0"});
         },0);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/6f0db273/lib/windows8/plugin/windows8/MediaProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/MediaProxy.js b/lib/windows8/plugin/windows8/MediaProxy.js
index cc779b1..6300510 100644
--- a/lib/windows8/plugin/windows8/MediaProxy.js
+++ b/lib/windows8/plugin/windows8/MediaProxy.js
@@ -23,6 +23,8 @@
 
 var cordova = require('cordova'),
     Media = require('cordova/plugin/Media');
+    
+var MediaError = require('cordova/plugin/MediaError');
 
 module.exports = {
     mediaCaptureMrg:null,
@@ -48,10 +50,9 @@ module.exports = {
                     dur = -1;
                 }
                 Media.onStatus(id, Media.MEDIA_DURATION, dur);
-            } else {
-                var result = new Object();
-                result.code = MediaError.MEDIA_ERR_ABORTED;
-                lose(result);
+            }
+            else {
+                lose && lose({code:MediaError.MEDIA_ERR_ABORTED});
             }
         }
     },