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 2013/01/09 01:45:14 UTC

js commit: Fix linting errors

Updated Branches:
  refs/heads/master d40d6a400 -> 0de682e1a


Fix linting errors


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/0de682e1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/0de682e1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/0de682e1

Branch: refs/heads/master
Commit: 0de682e1a3c481f0dfaa80b67b36a71a8a4ba7b1
Parents: d40d6a4
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Jan 8 16:44:10 2013 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Jan 8 16:44:10 2013 -0800

----------------------------------------------------------------------
 lib/common/plugin/InAppBrowser.js           |   64 +++++++++-------------
 lib/scripts/bootstrap.js                    |    2 +-
 lib/windows8/plugin/windows8/DeviceProxy.js |    6 +-
 3 files changed, 31 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0de682e1/lib/common/plugin/InAppBrowser.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/InAppBrowser.js b/lib/common/plugin/InAppBrowser.js
index cb845e2..9086b82 100644
--- a/lib/common/plugin/InAppBrowser.js
+++ b/lib/common/plugin/InAppBrowser.js
@@ -20,52 +20,42 @@
 */
 
 var exec = require('cordova/exec');
+var channel = require('cordova/channel');
 
-function InAppBrowser()
-{
-   var _channel = require('cordova/channel');
+function InAppBrowser() {
    this.channels = {
-        'loadstart': _channel.create('loadstart'),
-        'loadstop' : _channel.create('loadstop'),
-        'exit' : _channel.create('exit')
+        'loadstart': channel.create('loadstart'),
+        'loadstop' : channel.create('loadstop'),
+        'exit' : channel.create('exit')
    };
 }
 
-InAppBrowser.prototype._eventHandler = function(event)
-{
-    if (event.type in this.channels) {
-        this.channels[event.type].fire(event);
+InAppBrowser.prototype = {
+    _eventHandler: function (event) {
+        if (event.type in this.channels) {
+            this.channels[event.type].fire(event);
+        }
+    },
+    close: function (eventname) {
+        exec(null, null, "InAppBrowser", "close", []);
+    },
+    addEventListener: function (eventname,f) {
+        if (eventname in this.channels) {
+            this.channels[eventname].subscribe(f);
+        }
+    },
+    removeEventListener: function(eventname, f) {
+        if (eventname in this.channels) {
+            this.channels[eventname].unsubscribe(f);
+        }
     }
-}
+};
 
-InAppBrowser.open = function(strUrl, strWindowName, strWindowFeatures)
-{
+module.exports = function(strUrl, strWindowName, strWindowFeatures) {
     var iab = new InAppBrowser();
     var cb = function(eventname) {
        iab._eventHandler(eventname);
-    }
+    };
     exec(cb, null, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]);
     return iab;
-}
-
-InAppBrowser.prototype.close = function(eventname, f)
-{
-    exec(null, null, "InAppBrowser", "close", []);
-}
-
-InAppBrowser.prototype.addEventListener = function(eventname, f)
-{
-    if (eventname in this.channels) {
-        this.channels[eventname].subscribe(f);
-    }
-}
-
-InAppBrowser.prototype.removeEventListener = function(eventname, f)
-{
-    if (eventname in this.channels) {
-        this.channels[eventname].unsubscribe(f);
-    }
-}
-
-module.exports = InAppBrowser.open;
-
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0de682e1/lib/scripts/bootstrap.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap.js b/lib/scripts/bootstrap.js
index 04e61d9..62f3e69 100644
--- a/lib/scripts/bootstrap.js
+++ b/lib/scripts/bootstrap.js
@@ -23,7 +23,7 @@
     // Replace navigator before any modules are required(), to ensure it happens as soon as possible.
     // We replace it so that properties that can't be clobbered can instead be overridden.
     if (context.navigator) {
-        function CordovaNavigator() {}
+        var CordovaNavigator = function() {};
         CordovaNavigator.prototype = context.navigator;
         context.navigator = new CordovaNavigator();
     }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0de682e1/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
index bdeb0c6..e523bff 100644
--- a/lib/windows8/plugin/windows8/DeviceProxy.js
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -42,15 +42,15 @@ module.exports = {
         var deviceId;
         var localSettings = Windows.Storage.ApplicationData.current.localSettings;
 
-        if (localSettings.values.deviceId != null) {
+        if (localSettings.values.deviceId) {
             deviceId = localSettings.values.deviceId;
         }
         else {
-            deviceId = localSettings.values.deviceId = utils.createUUID();;
+            deviceId = localSettings.values.deviceId = utils.createUUID();
         }
 
         setTimeout(function () {
-            win({ platform: "windows8", version: "8", name: name, uuid: deviceId, cordova: "2.2.0" });
+            win({ platform: "windows8", version: "8", name: name, uuid: deviceId, cordova: "2.3.0" });
         }, 0);
     }