cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [07/26] js commit: [Tizen, Tizen SDK 2.0 (Magnolia)]
Date Fri, 17 May 2013 17:53:25 GMT
[Tizen, Tizen SDK 2.0 (Magnolia)]

Adapt Battery to Magnolia
New Tizen SDK Api have introduce one changes "Power" was changed for "BATTERY"
perform some cleanup


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

Branch: refs/heads/3.0.0
Commit: cbb57b665b1f4666926491c01253ebd6657f792d
Parents: 3415606
Author: pplaquette <pplaquette@apache.org>
Authored: Wed Apr 17 11:17:32 2013 +0200
Committer: pplaquette <pplaquette@apache.org>
Committed: Fri Apr 19 11:07:14 2013 +0200

----------------------------------------------------------------------
 lib/tizen/plugin/tizen/Battery.js |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/cbb57b66/lib/tizen/plugin/tizen/Battery.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Battery.js b/lib/tizen/plugin/tizen/Battery.js
index a3c35c4..12b678b 100644
--- a/lib/tizen/plugin/tizen/Battery.js
+++ b/lib/tizen/plugin/tizen/Battery.js
@@ -20,24 +20,25 @@
 */
 
 /*global tizen:false */
-var id = null;
+var batteryListenerId = null;
 
 module.exports = {
     start: function(successCallback, errorCallback) {
-        var tizenSuccessCallback = function(power) {
+        var batterySuccessCallback = function(power) {
             if (successCallback) {
                 successCallback({level: Math.round(power.level * 100), isPlugged: power.isCharging});
             }
         };
 
-        if (id === null) {
-            id = tizen.systeminfo.addPropertyValueChangeListener("Power", tizenSuccessCallback);
+        if (batteryListenerId === null) {
+            batteryListenerId = tizen.systeminfo.addPropertyValueChangeListener("BATTERY",
batterySuccessCallback);
         }
-        tizen.systeminfo.getPropertyValue("Power", tizenSuccessCallback, errorCallback);
+
+        tizen.systeminfo.getPropertyValue("BATTERY", batterySuccessCallback, errorCallback);
     },
 
     stop: function(successCallback, errorCallback) {
-        tizen.systeminfo.removePropertyValueChangeListener(id);
-        id = null;
+        tizen.systeminfo.removePropertyValueChangeListener(batteryListenerId);
+        batteryListenerId = null;
     }
 };


Mime
View raw message