org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-386E1E84-6AD0-464F-9228-389126856177.html
changeset 229 716254ccbcc0
equal deleted inserted replaced
228:913c9751c067 229:716254ccbcc0
       
     1 
       
     2 <!DOCTYPE html
       
     3   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
     4 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="copyright" content="(C) Copyright 2009"/><meta name="DC.rights.owner" content="(C) Copyright 2009"/><meta name="DC.Type" content="mobileconcept"/><meta name="DC.Title" content="onchargelevel"/><meta name="DC.Relation" scheme="URI" content="GUID-E6C99179-3126-49F6-8E40-FB07E6FF8E38"/><meta name="DC.Relation" scheme="URI" content="GUID-F13F64A5-FFB0-4928-A888-BF2501E42091"/><meta name="DC.Relation" scheme="URI" content="GUID-7C69DDA4-16F1-4A8F-BDB2-4CB0015B4E81"/><meta name="DC.Relation" scheme="URI" content="GUID-65AAF569-D347-462B-B59A-9D7CA184AB9C"/><meta name="DC.Relation" scheme="URI" content="GUID-1A678A11-0BDD-4F64-9F40-013F6CDB81D7"/><meta name="DC.Relation" scheme="URI" content="GUID-6521F749-FA06-493B-A11D-B47F4DC0E6D6"/><meta name="DC.Format" content="XHTML"/><meta name="DC.Identifier" content="GUID-386E1E84-6AD0-464F-9228-389126856177"/><title>onchargelevel </title><script type="text/javascript">
       
     5       function initPage() {}
       
     6     </script><link href="../PRODUCT_PLUGIN/book.css" rel="stylesheet" type="text/css"/><link href="css/s60/style.css" rel="stylesheet" type="text/css" media="all"/></head><body onload="initPage();"><div class="body"><div class="contentLeft prTxt"><h1 class="pageHeading" id="GUID-386E1E84-6AD0-464F-9228-389126856177">onchargelevel</h1><div>
       
     7 <p><strong>Syntax:</strong></p>
       
     8 <pre class="codeblock" id="GUID-DCEE44D4-0AE0-46AA-9647-C3275F9AE5D2">sysinfo.chargelevel = "batteryLevelChange()";</pre>
       
     9 <pre class="codeblock" id="GUID-6882753C-D40D-45FB-9161-659DAFB73B5A">function batteryLevelChange()
       
    10 {
       
    11   // ...
       
    12 };</pre>
       
    13 <p><strong>Description:</strong></p>
       
    14 <p>The <code>onchargelevel</code> 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.</p>
       
    15 <p>For more general information on power consumption and widgets, see <a href="GUID-159FCC18-2C9D-49F0-BAC1-DFEAADCF1D89.html#GUID-159FCC18-2C9D-49F0-BAC1-DFEAADCF1D89">Saving battery time</a>.</p>
       
    16 <p><strong>Example code:</strong></p>
       
    17 <pre class="codeblock" id="GUID-F660C135-5697-4D8B-B525-EF9CA2046AEA">window.onload = function(){
       
    18  // Get the current battery level
       
    19  var batteryLevel = sysinfo.chargelevel;
       
    20  alert("Current battery level is " + batteryLevel + "%");
       
    21  // Assign an even handler for the charge level change
       
    22  sysinfo.onchargelevel = "batteryLevelChange()";
       
    23 }
       
    24 function batteryLevelChange()
       
    25 {
       
    26  var batteryLevel = sysinfo.chargelevel;
       
    27  alert("Current battery level is " + batteryLevel + "%");
       
    28 }</pre>
       
    29 </div></div></div><div class="footer"><hr/><div class="copy">© Nokia 2009.</div></div></body></html>