diff -r 913c9751c067 -r 716254ccbcc0 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/org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-386E1E84-6AD0-464F-9228-389126856177.html Fri Mar 05 19:11:15 2010 -0800 @@ -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 + "%"); +}+