diff -r 913c9751c067 -r 716254ccbcc0 org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-C3AAF370-D049-475B-9D21-3CFC5C83052F.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-C3AAF370-D049-475B-9D21-3CFC5C83052F.html Fri Mar 05 19:11:15 2010 -0800 @@ -0,0 +1,33 @@ + + +onchargerconnected

onchargerconnected

+

Syntax:

+
sysinfo.onchargerconnected = "chargerConnectedEventHandler()";
+function chargerConnectedEventHandler()
+{
+  // ...
+}
+

Description:

+

The onchargerconnected property is an event handler for the event of when the charger is plugged to or unplugged from the device.

+

Since the event is fired off much faster than the value is updated, it is recommended to read the value after a small delay. See example code for illustration.

+

For more general information on power consumption and widgets, see Saving battery time.

+

Example code:

+
window.onload = function(){
+  // Assign an even handler for the charger 
+  sysinfo.onchargerconnected = "chargerConnectedEvent()";
+}
+function chargerConnectedEvent()
+{
+   setTimeout("readValue();", 500);
+}
+function readValue()
+{
+   if (sysinfo.chargerconnected)
+      alert("Charger is connected");
+   else
+      alert("Charger is not connected");
+}
+
\ No newline at end of file