incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [27/32] git commit: Adding Battery API Docs
Date Fri, 20 Jan 2012 19:56:04 GMT
Adding Battery API Docs


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/7e450beb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/7e450beb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/7e450beb

Branch: refs/heads/master
Commit: 7e450beb767f9f52f6dcf5e16cb255eddd62b440
Parents: a5a19ef
Author: macdonst <simon.macdonald@gmail.com>
Authored: Thu Nov 17 11:40:31 2011 -0500
Committer: macdonst <simon.macdonald@gmail.com>
Committed: Thu Nov 17 11:40:31 2011 -0500

----------------------------------------------------------------------
 docs/en/1.2.0/config.json                          |    3 +
 .../phonegap/events/events.batterycritical.md      |   74 +++++++++++++++
 docs/en/1.2.0/phonegap/events/events.batterylow.md |   74 +++++++++++++++
 .../1.2.0/phonegap/events/events.batterystatus.md  |   74 +++++++++++++++
 docs/en/1.2.0/phonegap/events/events.md            |    3 +
 docs/en/edge/config.json                           |    3 +
 .../edge/phonegap/events/events.batterycritical.md |   74 +++++++++++++++
 docs/en/edge/phonegap/events/events.batterylow.md  |   74 +++++++++++++++
 .../edge/phonegap/events/events.batterystatus.md   |   74 +++++++++++++++
 docs/en/edge/phonegap/events/events.md             |    3 +
 10 files changed, 456 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/1.2.0/config.json
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/config.json b/docs/en/1.2.0/config.json
index 5b0a92e..5752429 100644
--- a/docs/en/1.2.0/config.json
+++ b/docs/en/1.2.0/config.json
@@ -79,6 +79,9 @@
             "phonegap/events/events.online.md",
             "phonegap/events/events.offline.md",
             "phonegap/events/events.backbutton.md",
+            "phonegap/events/events.batterycritical.md",
+            "phonegap/events/events.batterylow.md",
+            "phonegap/events/events.batterystatus.md",
             "phonegap/events/events.menubutton.md",
             "phonegap/events/events.searchbutton.md",
             "phonegap/events/events.startcallbutton.md",

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/1.2.0/phonegap/events/events.batterycritical.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/events/events.batterycritical.md b/docs/en/1.2.0/phonegap/events/events.batterycritical.md
new file mode 100644
index 0000000..e169a99
--- /dev/null
+++ b/docs/en/1.2.0/phonegap/events/events.batterycritical.md
@@ -0,0 +1,74 @@
+batterycritical
+===========
+
+This is an event that fires when a PhoneGap application detects the battery has reached the
critical level threshold.
+
+    window.addEventListener("batterycritical", yourCallbackFunction, false);
+
+Details
+-------
+
+This event that fires when a PhoneGap application detects the percentage of battery has reached
the critical battery threshold. This value is device specific.
+
+The batterycritical handler will be called with an object that contains two properties:
+
+- __level:__ The percentage of battery (0-100). _(Number)_
+- __isPlugged:__ A boolean that represents whether or not the device is plugged in or not.
_(Boolean)_
+
+Typically, you will want to attach an event listener with `window.addEventListener` once
you receive the PhoneGap 'deviceready' event.
+
+Supported Platforms
+-------------------
+
+- iOS
+- Android
+- BlackBerry WebWorks (OS 5.0 and higher)
+
+Quick Example
+-------------
+
+    window.addEventListener("batterycritical", onBatteryCritical, false);
+
+    function onBatteryCritical(info) {
+        // Handle the battery critical event
+       	alert("Battery Level Critical " + info.level + "%\nRecharge Soon!"); 
+    }
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>PhoneGap Device Ready Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Call onDeviceReady when PhoneGap is loaded.
+        //
+        // At this point, the document has loaded but phonegap.js has not.
+        // When PhoneGap is loaded and talking with the native device,
+        // it will call the event `deviceready`.
+        // 
+	    function onLoad() {
+    	    document.addEventListener("deviceready", onDeviceReady, false);
+    	}
+
+        // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
+        //
+        function onDeviceReady() {
+		    window.addEventListener("batterycritical", onBatteryCritical, false);
+        }
+
+        // Handle the batterycritical event
+        //
+        function onBatteryCritical(info) {
+	       	alert("Battery Level Critical " + info.level + "%\nRecharge Soon!"); 
+        }
+        
+        </script>
+      </head>
+      <body onload="onLoad()">
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/1.2.0/phonegap/events/events.batterylow.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/events/events.batterylow.md b/docs/en/1.2.0/phonegap/events/events.batterylow.md
new file mode 100644
index 0000000..e051be4
--- /dev/null
+++ b/docs/en/1.2.0/phonegap/events/events.batterylow.md
@@ -0,0 +1,74 @@
+batterylow
+===========
+
+This is an event that fires when a PhoneGap application detects the battery has reached the
low level threshold.
+
+    window.addEventListener("batterylow", yourCallbackFunction, false);
+
+Details
+-------
+
+This event that fires when a PhoneGap application detects the percentage of battery has reached
the low battery threshold. This value is device specific.
+
+The batterylow handler will be called with an object that contains two properties:
+
+- __level:__ The percentage of battery (0-100). _(Number)_
+- __isPlugged:__ A boolean that represents whether or not the device is plugged in or not.
_(Boolean)_
+
+Typically, you will want to attach an event listener with `document.addEventListener` once
you receive the PhoneGap 'deviceready' event.
+
+Supported Platforms
+-------------------
+
+- iOS
+- Android
+- BlackBerry WebWorks (OS 5.0 and higher)
+
+Quick Example
+-------------
+
+    window.addEventListener("batterylow", onBatteryLow, false);
+
+    function onBatteryLow(info) {
+        // Handle the battery low event
+       	alert("Battery Level Low " + info.level + "%"); 
+    }
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>PhoneGap Device Ready Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Call onDeviceReady when PhoneGap is loaded.
+        //
+        // At this point, the document has loaded but phonegap.js has not.
+        // When PhoneGap is loaded and talking with the native device,
+        // it will call the event `deviceready`.
+        // 
+	    function onLoad() {
+    	    document.addEventListener("deviceready", onDeviceReady, false);
+    	}
+
+        // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
+        //
+        function onDeviceReady() {
+		    window.addEventListener("batterylow", onBatteryLow, false);
+        }
+
+        // Handle the batterylow event
+        //
+        function onBatteryLow(info) {
+	       	alert("Battery Level Low " + info.level + "%"); 
+        }
+        
+        </script>
+      </head>
+      <body onload="onLoad()">
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/1.2.0/phonegap/events/events.batterystatus.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/events/events.batterystatus.md b/docs/en/1.2.0/phonegap/events/events.batterystatus.md
new file mode 100644
index 0000000..1fa5dc0
--- /dev/null
+++ b/docs/en/1.2.0/phonegap/events/events.batterystatus.md
@@ -0,0 +1,74 @@
+batterystatus
+===========
+
+This is an event that fires when a PhoneGap application detects a change in the battery status.
+
+    window.addEventListener("batterystatus", yourCallbackFunction, false);
+
+Details
+-------
+
+This event that fires when a PhoneGap application detects the percentage of battery has changed
by at least 1 percent. It is also fired if the device has been plugged in or un-plugged.
+
+The battery status handler will be called with an object that contains two properties:
+
+- __level:__ The percentage of battery (0-100). _(Number)_
+- __isPlugged:__ A boolean that represents whether or not the device is plugged in or not.
_(Boolean)_
+
+Typically, you will want to attach an event listener with `window.addEventListener` once
you receive the PhoneGap 'deviceready' event.
+
+Supported Platforms
+-------------------
+
+- iOS
+- Android
+- BlackBerry WebWorks (OS 5.0 and higher)
+
+Quick Example
+-------------
+
+    window.addEventListener("batterystatus", onBatteryStatus, false);
+
+    function onBatteryStatus(info) {
+        // Handle the online event
+       	console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
+    }
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>PhoneGap Device Ready Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Call onDeviceReady when PhoneGap is loaded.
+        //
+        // At this point, the document has loaded but phonegap.js has not.
+        // When PhoneGap is loaded and talking with the native device,
+        // it will call the event `deviceready`.
+        // 
+	    function onLoad() {
+    	    document.addEventListener("deviceready", onDeviceReady, false);
+    	}
+
+        // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
+        //
+        function onDeviceReady() {
+		    window.addEventListener("batterystatus", onBatteryStatus, false);
+        }
+
+        // Handle the batterystatus event
+        //
+        function onBatteryStatus(info) {
+        	console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
+        }
+        
+        </script>
+      </head>
+      <body onload="onLoad()">
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/1.2.0/phonegap/events/events.md
----------------------------------------------------------------------
diff --git a/docs/en/1.2.0/phonegap/events/events.md b/docs/en/1.2.0/phonegap/events/events.md
index 7267883..831138f 100644
--- a/docs/en/1.2.0/phonegap/events/events.md
+++ b/docs/en/1.2.0/phonegap/events/events.md
@@ -12,6 +12,9 @@ Event Types
 - online
 - offline
 - backbutton
+- batterycritical
+- batterylow
+- batterystatus
 - menubutton
 - searchbutton
 - startcallbutton

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/edge/config.json
----------------------------------------------------------------------
diff --git a/docs/en/edge/config.json b/docs/en/edge/config.json
index 5b0a92e..5752429 100644
--- a/docs/en/edge/config.json
+++ b/docs/en/edge/config.json
@@ -79,6 +79,9 @@
             "phonegap/events/events.online.md",
             "phonegap/events/events.offline.md",
             "phonegap/events/events.backbutton.md",
+            "phonegap/events/events.batterycritical.md",
+            "phonegap/events/events.batterylow.md",
+            "phonegap/events/events.batterystatus.md",
             "phonegap/events/events.menubutton.md",
             "phonegap/events/events.searchbutton.md",
             "phonegap/events/events.startcallbutton.md",

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/edge/phonegap/events/events.batterycritical.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/phonegap/events/events.batterycritical.md b/docs/en/edge/phonegap/events/events.batterycritical.md
new file mode 100644
index 0000000..e169a99
--- /dev/null
+++ b/docs/en/edge/phonegap/events/events.batterycritical.md
@@ -0,0 +1,74 @@
+batterycritical
+===========
+
+This is an event that fires when a PhoneGap application detects the battery has reached the
critical level threshold.
+
+    window.addEventListener("batterycritical", yourCallbackFunction, false);
+
+Details
+-------
+
+This event that fires when a PhoneGap application detects the percentage of battery has reached
the critical battery threshold. This value is device specific.
+
+The batterycritical handler will be called with an object that contains two properties:
+
+- __level:__ The percentage of battery (0-100). _(Number)_
+- __isPlugged:__ A boolean that represents whether or not the device is plugged in or not.
_(Boolean)_
+
+Typically, you will want to attach an event listener with `window.addEventListener` once
you receive the PhoneGap 'deviceready' event.
+
+Supported Platforms
+-------------------
+
+- iOS
+- Android
+- BlackBerry WebWorks (OS 5.0 and higher)
+
+Quick Example
+-------------
+
+    window.addEventListener("batterycritical", onBatteryCritical, false);
+
+    function onBatteryCritical(info) {
+        // Handle the battery critical event
+       	alert("Battery Level Critical " + info.level + "%\nRecharge Soon!"); 
+    }
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>PhoneGap Device Ready Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Call onDeviceReady when PhoneGap is loaded.
+        //
+        // At this point, the document has loaded but phonegap.js has not.
+        // When PhoneGap is loaded and talking with the native device,
+        // it will call the event `deviceready`.
+        // 
+	    function onLoad() {
+    	    document.addEventListener("deviceready", onDeviceReady, false);
+    	}
+
+        // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
+        //
+        function onDeviceReady() {
+		    window.addEventListener("batterycritical", onBatteryCritical, false);
+        }
+
+        // Handle the batterycritical event
+        //
+        function onBatteryCritical(info) {
+	       	alert("Battery Level Critical " + info.level + "%\nRecharge Soon!"); 
+        }
+        
+        </script>
+      </head>
+      <body onload="onLoad()">
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/edge/phonegap/events/events.batterylow.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/phonegap/events/events.batterylow.md b/docs/en/edge/phonegap/events/events.batterylow.md
new file mode 100644
index 0000000..e051be4
--- /dev/null
+++ b/docs/en/edge/phonegap/events/events.batterylow.md
@@ -0,0 +1,74 @@
+batterylow
+===========
+
+This is an event that fires when a PhoneGap application detects the battery has reached the
low level threshold.
+
+    window.addEventListener("batterylow", yourCallbackFunction, false);
+
+Details
+-------
+
+This event that fires when a PhoneGap application detects the percentage of battery has reached
the low battery threshold. This value is device specific.
+
+The batterylow handler will be called with an object that contains two properties:
+
+- __level:__ The percentage of battery (0-100). _(Number)_
+- __isPlugged:__ A boolean that represents whether or not the device is plugged in or not.
_(Boolean)_
+
+Typically, you will want to attach an event listener with `document.addEventListener` once
you receive the PhoneGap 'deviceready' event.
+
+Supported Platforms
+-------------------
+
+- iOS
+- Android
+- BlackBerry WebWorks (OS 5.0 and higher)
+
+Quick Example
+-------------
+
+    window.addEventListener("batterylow", onBatteryLow, false);
+
+    function onBatteryLow(info) {
+        // Handle the battery low event
+       	alert("Battery Level Low " + info.level + "%"); 
+    }
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>PhoneGap Device Ready Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Call onDeviceReady when PhoneGap is loaded.
+        //
+        // At this point, the document has loaded but phonegap.js has not.
+        // When PhoneGap is loaded and talking with the native device,
+        // it will call the event `deviceready`.
+        // 
+	    function onLoad() {
+    	    document.addEventListener("deviceready", onDeviceReady, false);
+    	}
+
+        // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
+        //
+        function onDeviceReady() {
+		    window.addEventListener("batterylow", onBatteryLow, false);
+        }
+
+        // Handle the batterylow event
+        //
+        function onBatteryLow(info) {
+	       	alert("Battery Level Low " + info.level + "%"); 
+        }
+        
+        </script>
+      </head>
+      <body onload="onLoad()">
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/edge/phonegap/events/events.batterystatus.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/phonegap/events/events.batterystatus.md b/docs/en/edge/phonegap/events/events.batterystatus.md
new file mode 100644
index 0000000..1fa5dc0
--- /dev/null
+++ b/docs/en/edge/phonegap/events/events.batterystatus.md
@@ -0,0 +1,74 @@
+batterystatus
+===========
+
+This is an event that fires when a PhoneGap application detects a change in the battery status.
+
+    window.addEventListener("batterystatus", yourCallbackFunction, false);
+
+Details
+-------
+
+This event that fires when a PhoneGap application detects the percentage of battery has changed
by at least 1 percent. It is also fired if the device has been plugged in or un-plugged.
+
+The battery status handler will be called with an object that contains two properties:
+
+- __level:__ The percentage of battery (0-100). _(Number)_
+- __isPlugged:__ A boolean that represents whether or not the device is plugged in or not.
_(Boolean)_
+
+Typically, you will want to attach an event listener with `window.addEventListener` once
you receive the PhoneGap 'deviceready' event.
+
+Supported Platforms
+-------------------
+
+- iOS
+- Android
+- BlackBerry WebWorks (OS 5.0 and higher)
+
+Quick Example
+-------------
+
+    window.addEventListener("batterystatus", onBatteryStatus, false);
+
+    function onBatteryStatus(info) {
+        // Handle the online event
+       	console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
+    }
+
+Full Example
+------------
+
+    <!DOCTYPE html>
+    <html>
+      <head>
+        <title>PhoneGap Device Ready Example</title>
+
+        <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
+        <script type="text/javascript" charset="utf-8">
+
+        // Call onDeviceReady when PhoneGap is loaded.
+        //
+        // At this point, the document has loaded but phonegap.js has not.
+        // When PhoneGap is loaded and talking with the native device,
+        // it will call the event `deviceready`.
+        // 
+	    function onLoad() {
+    	    document.addEventListener("deviceready", onDeviceReady, false);
+    	}
+
+        // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
+        //
+        function onDeviceReady() {
+		    window.addEventListener("batterystatus", onBatteryStatus, false);
+        }
+
+        // Handle the batterystatus event
+        //
+        function onBatteryStatus(info) {
+        	console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
+        }
+        
+        </script>
+      </head>
+      <body onload="onLoad()">
+      </body>
+    </html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/7e450beb/docs/en/edge/phonegap/events/events.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/phonegap/events/events.md b/docs/en/edge/phonegap/events/events.md
index 7267883..831138f 100644
--- a/docs/en/edge/phonegap/events/events.md
+++ b/docs/en/edge/phonegap/events/events.md
@@ -12,6 +12,9 @@ Event Types
 - online
 - offline
 - backbutton
+- batterycritical
+- batterylow
+- batterystatus
 - menubutton
 - searchbutton
 - startcallbutton


Mime
View raw message