diff -r 4d198a32ac7d -r d4809db37847 plugins/org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-386E1E84-6AD0-464F-9228-389126856177.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-386E1E84-6AD0-464F-9228-389126856177.html Thu Aug 19 17:48:04 2010 -0700 @@ -0,0 +1,29 @@ + + +
Syntax:
+sysinfo.chargelevel = "batteryLevelChange()";+
function batteryLevelChange() +{ + // ... +};+
Description:
+The onchargelevel
property is an event handler for the event of when the battery level is changed. The callback function is assigned by providing the function's name wrapped in a string.
For more general information on power consumption and widgets, see Saving battery time.
+Example code:
+window.onload = function(){ + // Get the current battery level + var batteryLevel = sysinfo.chargelevel; + alert("Current battery level is " + batteryLevel + "%"); + // Assign an even handler for the charge level change + sysinfo.onchargelevel = "batteryLevelChange()"; +} +function batteryLevelChange() +{ + var batteryLevel = sysinfo.chargelevel; + alert("Current battery level is " + batteryLevel + "%"); +}+