You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by al...@apache.org on 2016/12/12 11:46:30 UTC

cordova-plugin-battery-status git commit: CB-12227 (windows) Fixed Browserify error

Repository: cordova-plugin-battery-status
Updated Branches:
  refs/heads/master 76d388a48 -> 1d8218621


CB-12227 (windows) Fixed Browserify error


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/commit/1d821862
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/tree/1d821862
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/diff/1d821862

Branch: refs/heads/master
Commit: 1d8218621645e45c25898d04f5e87d41e90b3e6a
Parents: 76d388a
Author: Alexander Sorokin <al...@akvelon.com>
Authored: Mon Dec 12 14:29:54 2016 +0300
Committer: Alexander Sorokin <al...@akvelon.com>
Committed: Mon Dec 12 14:39:30 2016 +0300

----------------------------------------------------------------------
 src/windows/BatteryProxy.js | 104 +++++++++++++++++++--------------------
 1 file changed, 52 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/blob/1d821862/src/windows/BatteryProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/BatteryProxy.js b/src/windows/BatteryProxy.js
index 9f5ac66..52a5c2c 100644
--- a/src/windows/BatteryProxy.js
+++ b/src/windows/BatteryProxy.js
@@ -57,69 +57,69 @@ if (PowerManager) {
     };
 
     require("cordova/exec/proxy").add("Battery", BatteryWin10);
-    return;
-}
 
+} else {
+    
+    var stopped;
 
-var stopped;
+    var handleResponse = function(successCb, errorCb, jsonResponse) {
+        var info = JSON.parse(jsonResponse);
 
-function handleResponse(successCb, errorCb, jsonResponse) {
-    var info = JSON.parse(jsonResponse);
+        if (info.hasOwnProperty("exceptionMessage")) {
+            errorCb(info.exceptionMessage);
+            return;
+        }
 
-    if (info.hasOwnProperty("exceptionMessage")) {
-        errorCb(info.exceptionMessage);
-        return;
-    }
+        successCb(info, { keepCallback: true });
+    };
 
-    successCb(info, { keepCallback: true });
-}
+    var Battery = {
+        start: function (win, fail, args, env) {
+            function getBatteryStatus(success, error) {
+                handleResponse(success, error, BatteryStatus.BatteryStatus.start());
+            }
 
-var Battery = {
-    start: function (win, fail, args, env) {
-        function getBatteryStatus(success, error) {
-            handleResponse(success, error, BatteryStatus.BatteryStatus.start());
-        }
+            function getBatteryStatusLevelChangeEvent(success, error) {
+                return BatteryStatus.BatteryStatus.getBatteryStatusChangeEvent().done(function (result) {
+                    if (stopped) {
+                        return;
+                    }
 
-        function getBatteryStatusLevelChangeEvent(success, error) {
-            return BatteryStatus.BatteryStatus.getBatteryStatusChangeEvent().done(function (result) {
-                if (stopped) {
-                    return;
-                }
+                    handleResponse(success, error, result);
 
-                handleResponse(success, error, result);
+                    setTimeout(function() { getBatteryStatusLevelChangeEvent(success, error); }, 0);
+                }, function(err) {
+                    fail(err);
+                });
+            }
 
-                setTimeout(function() { getBatteryStatusLevelChangeEvent(success, error); }, 0);
-            }, function(err) {
-                fail(err);
-            });
-        }
+            // Battery API supported on Phone devices only so in case of
+            // desktop/tablet the only one choice is to fail with appropriate message.
+            if (!WinJS.Utilities.isPhone) {
+                fail("The operation is not supported on Windows Desktop devices.");
+                return;
+            }
 
-        // Battery API supported on Phone devices only so in case of
-        // desktop/tablet the only one choice is to fail with appropriate message.
-        if (!WinJS.Utilities.isPhone) {
-            fail("The operation is not supported on Windows Desktop devices.");
-            return;
-        }
+            stopped = false;
+            try {
+                getBatteryStatus(win, fail);
+                getBatteryStatusLevelChangeEvent(win, fail);
+            } catch(e) {
+                fail(e);
+            }
+        },
 
-        stopped = false;
-        try {
-            getBatteryStatus(win, fail);
-            getBatteryStatusLevelChangeEvent(win, fail);
-        } catch(e) {
-            fail(e);
-        }
-    },
+        stop: function () {
+            // Battery API supported on Phone devices only so in case of
+            // desktop/tablet device we don't need for any actions.
+            if (!WinJS.Utilities.isPhone) {
+                return;
+            }
 
-    stop: function () {
-        // Battery API supported on Phone devices only so in case of
-        // desktop/tablet device we don't need for any actions.
-        if (!WinJS.Utilities.isPhone) {
-            return;
+            stopped = true;
+            BatteryStatus.BatteryStatus.stop();
         }
+    };
 
-        stopped = true;
-        BatteryStatus.BatteryStatus.stop();
-    }
-};
-
-require("cordova/exec/proxy").add("Battery", Battery);
+    require("cordova/exec/proxy").add("Battery", Battery);
+}


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