cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From audre...@apache.org
Subject cordova-plugin-device git commit: CB-12895 : setup eslint and removed jshint
Date Wed, 09 Aug 2017 18:50:35 GMT
Repository: cordova-plugin-device
Updated Branches:
  refs/heads/master 965f65d9d -> 3dfbb7826


CB-12895 : setup eslint and removed jshint


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/3dfbb782
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/3dfbb782
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/3dfbb782

Branch: refs/heads/master
Commit: 3dfbb7826fff868179dcc5e028992eedf9cb7121
Parents: 965f65d
Author: Audrey So <audreyso@apache.org>
Authored: Fri Jun 9 15:27:27 2017 -0700
Committer: Audrey So <audreyso@apache.org>
Committed: Mon Aug 7 09:01:55 2017 -0700

----------------------------------------------------------------------
 .eslintrc.yml                |  10 +++
 .jshintrc                    |  15 -----
 package.json                 |  12 +++-
 src/blackberry10/index.js    |  38 +++++------
 src/browser/DeviceProxy.js   |  13 ++--
 src/firefoxos/DeviceProxy.js |  18 +++---
 src/tizen/DeviceProxy.js     |   4 +-
 src/ubuntu/device.js         |  14 ++--
 src/windows/DeviceProxy.js   |  56 ++++++++--------
 tests/tests.js               | 132 +++++++++++++++++++-------------------
 www/device.js                |  28 ++++----
 11 files changed, 171 insertions(+), 169 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..0cccb8c
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,10 @@
+root: true
+extends: semistandard
+rules:
+  indent:
+    - error
+    - 4
+  camelcase: off
+  padded-blocks: off
+  operator-linebreak: off
+  no-throw-literal: off
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index dd79047..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-    "browser": true
-  , "bitwise": true
-  , "undef": true
-  , "trailing": true
-  , "quotmark": false
-  , "indent": 4
-  , "unused": "vars"
-  , "latedef": "nofunc"
-  , "globals": {
-        "module": false,
-        "exports": false,
-        "require": false
-    }
-}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 67e9a26..fbcba71 100644
--- a/package.json
+++ b/package.json
@@ -47,8 +47,8 @@
     "cordova-osx"
   ],
   "scripts": {
-    "test": "npm run jshint",
-    "jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint
src && node node_modules/jshint/bin/jshint tests"
+    "test": "npm run eslint",
+    "eslint": "node node_modules/eslint/bin/eslint www && node node_modules/eslint/bin/eslint
src && node node_modules/eslint/bin/eslint tests"
   },
   "author": "Apache Software Foundation",
   "license": "Apache-2.0",
@@ -60,6 +60,12 @@
     }
   },
   "devDependencies": {
-    "jshint": "^2.6.0"
+    "eslint": "^3.19.0",
+    "eslint-config-semistandard": "^11.0.0",
+    "eslint-config-standard": "^10.2.1",
+    "eslint-plugin-import": "^2.3.0",
+    "eslint-plugin-node": "^5.0.0",
+    "eslint-plugin-promise": "^3.5.0",
+    "eslint-plugin-standard": "^3.0.1"
   }
 }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
index ef0543b..699b336 100644
--- a/src/blackberry10/index.js
+++ b/src/blackberry10/index.js
@@ -23,17 +23,17 @@
 
 function getModelName () {
     var modelName = window.qnx.webplatform.device.modelName;
-    //Pre 10.2 (meaning Z10 or Q10)
-    if (typeof modelName === "undefined") {
+    // Pre 10.2 (meaning Z10 or Q10)
+    if (typeof modelName === 'undefined') {
         if (window.screen.height === 720 && window.screen.width === 720) {
-            if ( window.matchMedia("(-blackberry-display-technology: -blackberry-display-oled)").matches)
{
-                modelName = "Q10";
+            if (window.matchMedia('(-blackberry-display-technology: -blackberry-display-oled)').matches)
{
+                modelName = 'Q10';
             } else {
-                modelName = "Q5";
+                modelName = 'Q5';
             }
         } else if ((window.screen.height === 1280 && window.screen.width === 768)
||
                    (window.screen.height === 768 && window.screen.width === 1280))
{
-            modelName = "Z10";
+            modelName = 'Z10';
         } else {
             modelName = window.qnx.webplatform.deviceName;
         }
@@ -43,28 +43,28 @@ function getModelName () {
 }
 
 function getUUID () {
-    var uuid = "";
+    var uuid = '';
     try {
-        //Must surround by try catch because this will throw if the app is missing permissions
+        // Must surround by try catch because this will throw if the app is missing permissions
         uuid = window.qnx.webplatform.device.devicePin;
     } catch (e) {
-        //DO Nothing
+        // DO Nothing
     }
     return uuid;
 }
 
 module.exports = {
     getDeviceInfo: function (success, fail, args, env) {
-        var result = new PluginResult(args, env),
-            modelName = getModelName(),
-            uuid = getUUID(),
-            info = {
-                manufacturer: 'BlackBerry',
-                platform: "blackberry10",
-                version: window.qnx.webplatform.device.scmBundle,
-                model: modelName,
-                uuid: uuid
-            };
+        var result = new PluginResult(args, env);
+        var modelName = getModelName();
+        var uuid = getUUID();
+        var info = {
+            manufacturer: 'BlackBerry',
+            platform: 'blackberry10',
+            version: window.qnx.webplatform.device.scmBundle,
+            model: modelName,
+            uuid: uuid
+        };
 
         result.ok(info);
     }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/src/browser/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/src/browser/DeviceProxy.js b/src/browser/DeviceProxy.js
index dfb812f..4dc80ec 100644
--- a/src/browser/DeviceProxy.js
+++ b/src/browser/DeviceProxy.js
@@ -20,19 +20,19 @@
  */
 var browser = require('cordova/platform');
 
-function getPlatform() {
-    return "browser";
+function getPlatform () {
+    return 'browser';
 }
 
-function getModel() {
+function getModel () {
     return getBrowserInfo(true);
 }
 
-function getVersion() {
+function getVersion () {
     return getBrowserInfo(false);
 }
 
-function getBrowserInfo(getModel) {
+function getBrowserInfo (getModel) {
     var userAgent = navigator.userAgent;
     var returnVal = '';
     var offset;
@@ -66,7 +66,6 @@ function getBrowserInfo(getModel) {
     return returnVal;
 }
 
-
 module.exports = {
     getDeviceInfo: function (success, error) {
         setTimeout(function () {
@@ -82,4 +81,4 @@ module.exports = {
     }
 };
 
-require("cordova/exec/proxy").add("Device", module.exports);
+require('cordova/exec/proxy').add('Device', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/src/firefoxos/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/DeviceProxy.js b/src/firefoxos/DeviceProxy.js
index a05d7ca..7dd5df3 100644
--- a/src/firefoxos/DeviceProxy.js
+++ b/src/firefoxos/DeviceProxy.js
@@ -18,14 +18,14 @@
  * under the License.
  *
  */
-//example UA String for Firefox OS 
-//Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0
+// example UA String for Firefox OS
+// Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0
 
-//UA parsing not recommended but currently this is the only way to get the Firefox OS version
-//https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference
+// UA parsing not recommended but currently this is the only way to get the Firefox OS version
+// https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference
 
-//Should be replaced when better conversion to Firefox OS Version is available
-function convertVersionNumber(ver) {
+// Should be replaced when better conversion to Firefox OS Version is available
+function convertVersionNumber (ver) {
     var hashVersion = {
         '18.0': '1.0.1',
         '18.1': '1.1',
@@ -42,7 +42,7 @@ function convertVersionNumber(ver) {
     return (rver);
 
 }
-function getVersion() {
+function getVersion () {
     if (navigator.userAgent.match(/(mobile|tablet)/i)) {
         var ffVersionArray = (navigator.userAgent.match(/Firefox\/([\d]+\.[\w]?\.?[\w]+)/));
         if (ffVersionArray.length === 2) {
@@ -52,7 +52,7 @@ function getVersion() {
     return (null);
 }
 
-function getModel() {
+function getModel () {
     var uaArray = navigator.userAgent.split(/\s*[;)(]\s*/);
     if (navigator.userAgent.match(/(mobile|tablet)/i)) {
         if (uaArray.length === 5) {
@@ -74,4 +74,4 @@ module.exports = {
     }
 };
 
-require("cordova/exec/proxy").add("Device", module.exports);
+require('cordova/exec/proxy').add('Device', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/src/tizen/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/src/tizen/DeviceProxy.js b/src/tizen/DeviceProxy.js
index 973b716..90feab4 100644
--- a/src/tizen/DeviceProxy.js
+++ b/src/tizen/DeviceProxy.js
@@ -22,7 +22,7 @@
 var tizen = require('cordova/platform');
 
 module.exports = {
-    getDeviceInfo: function(success, error) {
+    getDeviceInfo: function (success, error) {
         setTimeout(function () {
             success({
                 cordova: tizen.cordovaVersion,
@@ -35,4 +35,4 @@ module.exports = {
     }
 };
 
-require("cordova/tizen/commandProxy").add("Device", module.exports);
+require('cordova/tizen/commandProxy').add('Device', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/src/ubuntu/device.js
----------------------------------------------------------------------
diff --git a/src/ubuntu/device.js b/src/ubuntu/device.js
index 838586c..df1632e 100644
--- a/src/ubuntu/device.js
+++ b/src/ubuntu/device.js
@@ -22,12 +22,16 @@
 /* global Cordova */
 
 module.exports = {
-    getInfo:function(win,fail,args) {
+    getInfo: function (win, fail, args) {
         Cordova.exec(function (model, cordova, platform, uuid, version) {
-            win({name: name, model: model, cordova: cordova,
-                 platform: platform, uuid: uuid, version: version});
-        }, null, "com.cordova.Device", "getInfo", []);
+            win({name: name, // eslint-disable-line no-undef
+                model: model,
+                cordova: cordova,
+                platform: platform,
+                uuid: uuid,
+                version: version});
+        }, null, 'com.cordova.Device', 'getInfo', []);
     }
 };
 
-require("cordova/exec/proxy").add("Device", module.exports);
+require('cordova/exec/proxy').add('Device', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/src/windows/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/DeviceProxy.js b/src/windows/DeviceProxy.js
index f338ad3..ccaaaee 100644
--- a/src/windows/DeviceProxy.js
+++ b/src/windows/DeviceProxy.js
@@ -21,16 +21,16 @@
 
 /* global Windows, createUUID */
 
-var ROOT_CONTAINER = "{00000000-0000-0000-FFFF-FFFFFFFFFFFF}";
-var DEVICE_CLASS_KEY = "{A45C254E-DF1C-4EFD-8020-67D146A850E0},10";
-var DEVICE_CLASS_KEY_NO_SEMICOLON = "{A45C254E-DF1C-4EFD-8020-67D146A850E0}10";
-var ROOT_CONTAINER_QUERY = "System.Devices.ContainerId:=\"" + ROOT_CONTAINER + "\"";
-var HAL_DEVICE_CLASS = "4d36e966-e325-11ce-bfc1-08002be10318";
-var DEVICE_DRIVER_VERSION_KEY = "{A8B865DD-2E3D-4094-AD97-E593A70C75D6},3";
+var ROOT_CONTAINER = '{00000000-0000-0000-FFFF-FFFFFFFFFFFF}';
+var DEVICE_CLASS_KEY = '{A45C254E-DF1C-4EFD-8020-67D146A850E0},10';
+var DEVICE_CLASS_KEY_NO_SEMICOLON = '{A45C254E-DF1C-4EFD-8020-67D146A850E0}10';
+var ROOT_CONTAINER_QUERY = 'System.Devices.ContainerId:="' + ROOT_CONTAINER + '"';
+var HAL_DEVICE_CLASS = '4d36e966-e325-11ce-bfc1-08002be10318';
+var DEVICE_DRIVER_VERSION_KEY = '{A8B865DD-2E3D-4094-AD97-E593A70C75D6},3';
 
 module.exports = {
 
-    getDeviceInfo:function(win, fail, args) {
+    getDeviceInfo: function (win, fail, args) {
 
         // deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId
         var deviceId;
@@ -38,8 +38,7 @@ module.exports = {
         var localSettings = Windows.Storage.ApplicationData.current.localSettings;
         if (localSettings.values.deviceId) {
             deviceId = localSettings.values.deviceId;
-        }
-        else {
+        } else {
             // App-specific hardware id could be used as uuid, but it changes if the hardware
changes...
             try {
                 var ASHWID = Windows.System.Profile.HardwareIdentification.getPackageSpecificToken(null).id;
@@ -48,22 +47,21 @@ module.exports = {
                 // Couldn't get the hardware UUID
                 deviceId = createUUID();
             }
-            //...so cache it per-install
+            // ...so cache it per-install
             localSettings.values.deviceId = deviceId;
         }
 
-
         var userAgent = window.clientInformation.userAgent;
         // this will report "windows" in windows8.1 and windows phone 8.1 apps
         // and "windows8" in windows 8.0 apps similar to cordova.js
         // See https://github.com/apache/cordova-js/blob/master/src/windows/platform.js#L25
-        var devicePlatform = userAgent.indexOf("MSAppHost/1.0") == -1 ? "windows" : "windows8";
+        var devicePlatform = userAgent.indexOf('MSAppHost/1.0') === -1 ? 'windows' : 'windows8';
         var versionString = userAgent.match(/Windows (?:Phone |NT )?([0-9.]+)/)[1];
 
         var deviceInfo = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation();
         // Running in the Windows Simulator is a remote session.
         // Running in the Windows Phone Emulator has the systemProductName set to "Virtual"
-        var isVirtual = Windows.System.RemoteDesktop.InteractiveSession.isRemote || deviceInfo.systemProductName
== "Virtual";
+        var isVirtual = Windows.System.RemoteDesktop.InteractiveSession.isRemote || deviceInfo.systemProductName
=== 'Virtual';
         var manufacturer = deviceInfo.systemManufacturer;
         var model = deviceInfo.systemProductName;
 
@@ -73,26 +71,26 @@ module.exports = {
                                 [DEVICE_DRIVER_VERSION_KEY, DEVICE_CLASS_KEY],
                                 ROOT_CONTAINER_QUERY)
         .then(function (rootDevices) {
-                for (var i = 0; i < rootDevices.length; i++) {
-                    var rootDevice = rootDevices[i];
-                    if (!rootDevice.properties) continue;
-                    if (rootDevice.properties[DEVICE_CLASS_KEY_NO_SEMICOLON] == HAL_DEVICE_CLASS)
{
-                        versionString = rootDevice.properties[DEVICE_DRIVER_VERSION_KEY];
-                        break;
-                    }
+            for (var i = 0; i < rootDevices.length; i++) {
+                var rootDevice = rootDevices[i];
+                if (!rootDevice.properties) continue;
+                if (rootDevice.properties[DEVICE_CLASS_KEY_NO_SEMICOLON] === HAL_DEVICE_CLASS)
{
+                    versionString = rootDevice.properties[DEVICE_DRIVER_VERSION_KEY];
+                    break;
                 }
+            }
 
-                setTimeout(function () {
-                    win({ platform: devicePlatform,
-                          version: versionString,
-                          uuid: deviceId,
-                          isVirtual: isVirtual,
-                          model: model,
-                          manufacturer:manufacturer});
-                }, 0);
+            setTimeout(function () {
+                win({ platform: devicePlatform,
+                    version: versionString,
+                    uuid: deviceId,
+                    isVirtual: isVirtual,
+                    model: model,
+                    manufacturer: manufacturer});
+            }, 0);
         });
     }
 
 }; // exports
 
-require("cordova/exec/proxy").add("Device", module.exports);
+require('cordova/exec/proxy').add('Device', module.exports);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index ac9a281..03e1fc7 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -19,72 +19,72 @@
  *
 */
 
-/* jshint jasmine: true */
+/* eslint-env jasmine */
+
+exports.defineAutoTests = function () {
+    describe('Device Information (window.device)', function () {
+        it('should exist', function () {
+            expect(window.device).toBeDefined();
+        });
+
+        it('should contain a platform specification that is a string', function () {
+            expect(window.device.platform).toBeDefined();
+            expect((String(window.device.platform)).length > 0).toBe(true);
+        });
+
+        it('should contain a version specification that is a string', function () {
+            expect(window.device.version).toBeDefined();
+            expect((String(window.device.version)).length > 0).toBe(true);
+        });
+
+        it('should contain a UUID specification that is a string or a number', function ()
{
+            expect(window.device.uuid).toBeDefined();
+            if (typeof window.device.uuid === 'string' || typeof window.device.uuid === 'object')
{
+                expect((String(window.device.uuid)).length > 0).toBe(true);
+            } else {
+                expect(window.device.uuid > 0).toBe(true);
+            }
+        });
+
+        it('should contain a cordova specification that is a string', function () {
+            expect(window.device.cordova).toBeDefined();
+            expect((String(window.device.cordova)).length > 0).toBe(true);
+        });
+
+        it('should depend on the presence of cordova.version string', function () {
+            expect(window.cordova.version).toBeDefined();
+            expect((String(window.cordova.version)).length > 0).toBe(true);
+        });
+
+        it('should contain device.cordova equal to cordova.version', function () {
+            expect(window.device.cordova).toBe(window.cordova.version);
+        });
+
+        it('should contain a model specification that is a string', function () {
+            expect(window.device.model).toBeDefined();
+            expect((String(window.device.model)).length > 0).toBe(true);
+        });
+
+        it('should contain a manufacturer property that is a string', function () {
+            expect(window.device.manufacturer).toBeDefined();
+            expect((String(window.device.manufacturer)).length > 0).toBe(true);
+        });
+
+        it('should contain an isVirtual property that is a boolean', function () {
+            expect(window.device.isVirtual).toBeDefined();
+            expect(typeof window.device.isVirtual).toBe('boolean');
+        });
+
+        it('should contain a serial number specification that is a string', function () {
+            expect(window.device.serial).toBeDefined();
+            expect((String(window.device.serial)).length > 0).toBe(true);
+
+        });
 
-exports.defineAutoTests = function() {
-  describe('Device Information (window.device)', function () {
-    it("should exist", function() {
-      expect(window.device).toBeDefined();
     });
-
-    it("should contain a platform specification that is a string", function() {
-      expect(window.device.platform).toBeDefined();
-      expect((String(window.device.platform)).length > 0).toBe(true);
-    });
-
-    it("should contain a version specification that is a string", function() {
-      expect(window.device.version).toBeDefined();
-      expect((String(window.device.version)).length > 0).toBe(true);
-    });
-
-    it("should contain a UUID specification that is a string or a number", function() {
-      expect(window.device.uuid).toBeDefined();
-      if (typeof window.device.uuid == 'string' || typeof window.device.uuid == 'object')
{
-        expect((String(window.device.uuid)).length > 0).toBe(true);
-      } else {
-        expect(window.device.uuid > 0).toBe(true);
-      }
-    });
-
-    it("should contain a cordova specification that is a string", function() {
-      expect(window.device.cordova).toBeDefined();
-      expect((String(window.device.cordova)).length > 0).toBe(true);
-    });
-
-    it("should depend on the presence of cordova.version string", function() {
-      expect(window.cordova.version).toBeDefined();
-      expect((String(window.cordova.version)).length > 0).toBe(true);
-    });
-
-    it("should contain device.cordova equal to cordova.version", function() {
-      expect(window.device.cordova).toBe(window.cordova.version);
-    });
-
-    it("should contain a model specification that is a string", function() {
-      expect(window.device.model).toBeDefined();
-      expect((String(window.device.model)).length > 0).toBe(true);
-    });
-
-    it("should contain a manufacturer property that is a string", function() {
-      expect(window.device.manufacturer).toBeDefined();
-      expect((String(window.device.manufacturer)).length > 0).toBe(true);
-    });
-
-    it("should contain an isVirtual property that is a boolean", function() {
-      expect(window.device.isVirtual).toBeDefined();
-      expect(typeof window.device.isVirtual).toBe("boolean");
-    });
-
-    it("should contain a serial number specification that is a string", function() {
-      expect(window.device.serial).toBeDefined();
-      expect((String(window.device.serial)).length > 0).toBe(true);
-
-    });
-
-  });
 };
 
-exports.defineManualTests = function(contentEl, createActionButton) {
+exports.defineManualTests = function (contentEl, createActionButton) {
     var logMessage = function (message, color) {
         var log = document.getElementById('info');
         var logLine = document.createElement('div');
@@ -106,8 +106,8 @@ exports.defineManualTests = function(contentEl, createActionButton) {
 
     contentEl.innerHTML = '<div id="info"></div>' + device_tests;
 
-    createActionButton('Dump device', function() {
-      clearLog();
-      logMessage(JSON.stringify(window.device, null, '\t'));
-    }, "dump_device");
+    createActionButton('Dump device', function () {
+        clearLog();
+        logMessage(JSON.stringify(window.device, null, '\t'));
+    }, 'dump_device');
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3dfbb782/www/device.js
----------------------------------------------------------------------
diff --git a/www/device.js b/www/device.js
index f7ed19f..41ed04f 100644
--- a/www/device.js
+++ b/www/device.js
@@ -19,11 +19,11 @@
  *
 */
 
-var argscheck = require('cordova/argscheck'),
-    channel = require('cordova/channel'),
-    utils = require('cordova/utils'),
-    exec = require('cordova/exec'),
-    cordova = require('cordova');
+var argscheck = require('cordova/argscheck');
+var channel = require('cordova/channel');
+var utils = require('cordova/utils');
+var exec = require('cordova/exec');
+var cordova = require('cordova');
 
 channel.createSticky('onCordovaInfoReady');
 // Tell cordova channel to wait on the CordovaInfoReady event
@@ -34,7 +34,7 @@ channel.waitForInitialization('onCordovaInfoReady');
  * phone, etc.
  * @constructor
  */
-function Device() {
+function Device () {
     this.available = false;
     this.platform = null;
     this.version = null;
@@ -47,10 +47,10 @@ function Device() {
 
     var me = this;
 
-    channel.onCordovaReady.subscribe(function() {
-        me.getInfo(function(info) {
-            //ignoring info.cordova returning from native, we should use value from cordova.version
defined in cordova.js
-            //TODO: CB-5105 native implementations should not return info.cordova
+    channel.onCordovaReady.subscribe(function () {
+        me.getInfo(function (info) {
+            // ignoring info.cordova returning from native, we should use value from cordova.version
defined in cordova.js
+            // TODO: CB-5105 native implementations should not return info.cordova
             var buildLabel = cordova.version;
             me.available = true;
             me.platform = info.platform;
@@ -62,9 +62,9 @@ function Device() {
             me.manufacturer = info.manufacturer || 'unknown';
             me.serial = info.serial || 'unknown';
             channel.onCordovaInfoReady.fire();
-        },function(e) {
+        }, function (e) {
             me.available = false;
-            utils.alert("[ERROR] Error initializing Cordova: " + e);
+            utils.alert('[ERROR] Error initializing Cordova: ' + e);
         });
     });
 }
@@ -75,9 +75,9 @@ function Device() {
  * @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) {
+Device.prototype.getInfo = function (successCallback, errorCallback) {
     argscheck.checkArgs('fF', 'Device.getInfo', arguments);
-    exec(successCallback, errorCallback, "Device", "getDeviceInfo", []);
+    exec(successCallback, errorCallback, 'Device', 'getDeviceInfo', []);
 };
 
 module.exports = new Device();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message