You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pp...@apache.org on 2013/05/17 16:22:24 UTC
[14/21] js commit: [Tizen, Tizen SDK 2.0 (Magnolia)]
[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/master
Commit: cbb57b665b1f4666926491c01253ebd6657f792d
Parents: 3415606
Author: pplaquette <pp...@apache.org>
Authored: Wed Apr 17 11:17:32 2013 +0200
Committer: pplaquette <pp...@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;
}
};