You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by mw...@apache.org on 2013/06/12 19:51:17 UTC
[42/46] docs commit: sanitize code & trim xtra Cordova refs
sanitize code & trim xtra Cordova refs
Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/f98807e7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/f98807e7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/f98807e7
Branch: refs/heads/master
Commit: f98807e77597be662fb95126a04c2d3dd5918874
Parents: 0c0ab55
Author: Mike Sierra <le...@gmail.com>
Authored: Thu May 30 12:06:09 2013 -0400
Committer: Mike Sierra <le...@gmail.com>
Committed: Thu May 30 12:06:09 2013 -0400
----------------------------------------------------------------------
.../accelerometer/acceleration/acceleration.md | 8 +-
.../accelerometer/accelerometer.clearWatch.md | 26 ++--
.../accelerometer.getCurrentAcceleration.md | 10 +-
.../accelerometer.watchAcceleration.md | 34 ++---
.../en/edge/cordova/camera/camera.getPicture.md | 30 ++--
.../camera/parameter/CameraPopoverOptions.md | 28 ++--
.../edge/cordova/compass/compass.clearWatch.md | 18 +--
.../compass/compass.getCurrentHeading.md | 8 +-
docs/en/edge/cordova/compass/compass.md | 4 +-
.../cordova/compass/compass.watchHeading.md | 22 +--
.../compass/compassError/compassError.md | 4 +-
.../edge/cordova/connection/connection.type.md | 74 +++++-----
.../en/edge/cordova/contacts/Contact/contact.md | 114 +++++++--------
.../contacts/ContactAddress/contactaddress.md | 79 +++++------
.../contacts/ContactField/contactfield.md | 97 ++++++-------
.../ContactFindOptions/contactfindoptions.md | 56 ++++----
.../cordova/contacts/ContactName/contactname.md | 56 ++++----
.../ContactOrganization/contactorganization.md | 62 ++++-----
.../en/edge/cordova/contacts/contacts.create.md | 12 +-
docs/en/edge/cordova/contacts/contacts.find.md | 87 ++++++------
docs/en/edge/cordova/device/device.cordova.md | 6 +-
docs/en/edge/cordova/device/device.model.md | 10 +-
docs/en/edge/cordova/device/device.name.md | 10 +-
docs/en/edge/cordova/device/device.platform.md | 6 +-
docs/en/edge/cordova/device/device.uuid.md | 6 +-
docs/en/edge/cordova/device/device.version.md | 6 +-
.../en/edge/cordova/events/events.backbutton.md | 19 ++-
.../cordova/events/events.batterycritical.md | 28 ++--
.../en/edge/cordova/events/events.batterylow.md | 26 ++--
.../edge/cordova/events/events.batterystatus.md | 26 ++--
.../edge/cordova/events/events.deviceready.md | 25 ++--
.../edge/cordova/events/events.endcallbutton.md | 12 +-
.../en/edge/cordova/events/events.menubutton.md | 12 +-
docs/en/edge/cordova/events/events.offline.md | 14 +-
docs/en/edge/cordova/events/events.online.md | 16 +--
docs/en/edge/cordova/events/events.pause.md | 16 +--
docs/en/edge/cordova/events/events.resume.md | 14 +-
.../edge/cordova/events/events.searchbutton.md | 12 +-
.../cordova/events/events.startcallbutton.md | 12 +-
.../cordova/events/events.volumedownbutton.md | 12 +-
.../cordova/events/events.volumeupbutton.md | 12 +-
.../file/directoryentry/directoryentry.md | 64 ++++-----
.../file/directoryreader/directoryreader.md | 2 +-
.../en/edge/cordova/file/fileentry/fileentry.md | 48 +++----
docs/en/edge/cordova/file/fileobj/fileobj.md | 2 +-
.../edge/cordova/file/filereader/filereader.md | 139 +++++++++----------
.../edge/cordova/file/filesystem/filesystem.md | 38 ++---
.../cordova/file/filetransfer/filetransfer.md | 127 ++++++++---------
.../edge/cordova/file/filewriter/filewriter.md | 120 ++++++++--------
.../file/localfilesystem/localfilesystem.md | 54 +++----
docs/en/edge/cordova/file/metadata/metadata.md | 12 +-
.../geolocation/Coordinates/coordinates.md | 24 ++--
.../cordova/geolocation/Position/position.md | 36 ++---
.../geolocation/geolocation.clearWatch.md | 22 +--
.../geolocation.getCurrentPosition.md | 14 +-
.../geolocation/geolocation.watchPosition.md | 20 +--
.../GlobalizationError/globalizationerror.md | 10 +-
.../globalization/globalization.dateToString.md | 12 +-
.../globalization.getCurrencyPattern.md | 30 ++--
.../globalization/globalization.getDateNames.md | 22 +--
.../globalization.getDatePattern.md | 18 +--
.../globalization.getFirstDayOfWeek.md | 12 +-
.../globalization.getLocaleName.md | 10 +-
.../globalization.getNumberPattern.md | 36 ++---
.../globalization.getPreferredLanguage.md | 10 +-
.../globalization.isDayLightSavingsTime.md | 16 +--
.../globalization.numberToString.md | 16 +--
.../globalization/globalization.stringToDate.md | 18 +--
.../globalization.stringToNumber.md | 16 +--
.../edge/cordova/inappbrowser/inappbrowser.md | 24 ++--
.../en/edge/cordova/inappbrowser/window.open.md | 12 +-
.../edge/cordova/media/capture/captureAudio.md | 8 +-
.../edge/cordova/media/capture/captureImage.md | 10 +-
.../edge/cordova/media/capture/captureVideo.md | 10 +-
.../cordova/media/media.getCurrentPosition.md | 69 ++++-----
docs/en/edge/cordova/media/media.getDuration.md | 64 ++++-----
docs/en/edge/cordova/media/media.pause.md | 44 +++---
docs/en/edge/cordova/media/media.play.md | 50 +++----
docs/en/edge/cordova/media/media.release.md | 44 +++---
docs/en/edge/cordova/media/media.seekTo.md | 88 ++++++------
docs/en/edge/cordova/media/media.startRecord.md | 12 +-
docs/en/edge/cordova/media/media.stop.md | 33 ++---
docs/en/edge/cordova/media/media.stopRecord.md | 15 +-
.../cordova/notification/notification.alert.md | 30 ++--
.../cordova/notification/notification.beep.md | 14 +-
.../notification/notification.confirm.md | 12 +-
.../cordova/notification/notification.prompt.md | 4 +-
.../notification/notification.vibrate.md | 12 +-
.../cordova/splashscreen/splashscreen.hide.md | 8 +-
.../edge/cordova/splashscreen/splashscreen.md | 4 +-
.../cordova/splashscreen/splashscreen.show.md | 8 +-
.../edge/cordova/storage/database/database.md | 90 ++++++------
.../storage/localstorage/localstorage.md | 31 ++---
.../storage/sqlresultset/sqlresultset.md | 4 +-
.../sqlresultsetrowlist/sqlresultsetrowlist.md | 106 +++++++-------
.../storage/sqltransaction/sqltransaction.md | 86 ++++++------
.../cordova/storage/storage.opendatabase.md | 8 +-
docs/en/edge/guide/command-line/index.md | 4 +-
docs/en/edge/guide/cordova-webview/android.md | 10 +-
docs/en/edge/guide/cordova-webview/index.md | 4 +-
docs/en/edge/guide/cordova-webview/ios.md | 8 +-
.../edge/guide/getting-started/android/index.md | 4 +-
.../en/edge/guide/getting-started/bada/index.md | 4 +-
.../guide/getting-started/blackberry/index.md | 4 +-
docs/en/edge/guide/getting-started/index.md | 4 +-
docs/en/edge/guide/getting-started/ios/index.md | 6 +-
.../edge/guide/getting-started/tizen/index.md | 2 +-
.../guide/plugin-development/android/index.md | 2 +-
108 files changed, 1490 insertions(+), 1539 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/accelerometer/acceleration/acceleration.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/accelerometer/acceleration/acceleration.md b/docs/en/edge/cordova/accelerometer/acceleration/acceleration.md
index e365106..76cc8d8 100644
--- a/docs/en/edge/cordova/accelerometer/acceleration/acceleration.md
+++ b/docs/en/edge/cordova/accelerometer/acceleration/acceleration.md
@@ -33,8 +33,8 @@ Properties
Description
-----------
-This object is created and populated by Cordova, and returned by an
-`Accelerometer` method. Acceleration values include the effect of
+An `Acceleration` object is populated and returned by any of the API's
+`Accelerometer` methods. Acceleration values include the effect of
gravity (9.81 m/s^2), so that when a device lies flat and facing up,
_x_, _y_, and _z_ values returned should be `0`, `0`, and `9.81`.
@@ -77,11 +77,11 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/accelerometer/accelerometer.clearWatch.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/accelerometer/accelerometer.clearWatch.md b/docs/en/edge/cordova/accelerometer/accelerometer.clearWatch.md
index 1706433..a32b1c4 100644
--- a/docs/en/edge/cordova/accelerometer/accelerometer.clearWatch.md
+++ b/docs/en/edge/cordova/accelerometer/accelerometer.clearWatch.md
@@ -41,11 +41,11 @@ Quick Example
-------------
var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
-
+
// ... later on ...
-
+
navigator.accelerometer.clearWatch(watchID);
-
+
Full Example
------------
@@ -59,12 +59,12 @@ Full Example
// The watch id references the current `watchAcceleration`
var watchID = null;
-
- // Wait for Cordova to load
+
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
startWatch();
@@ -73,13 +73,13 @@ Full Example
// Start watching the acceleration
//
function startWatch() {
-
+
// Update acceleration every 3 seconds
var options = { frequency: 3000 };
-
+
watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
}
-
+
// Stop watching the acceleration
//
function stopWatch() {
@@ -93,9 +93,9 @@ Full Example
//
function onSuccess(acceleration) {
var element = document.getElementById('accelerometer');
- element.innerHTML = 'Acceleration X: ' + acceleration.x + '<br />' +
- 'Acceleration Y: ' + acceleration.y + '<br />' +
- 'Acceleration Z: ' + acceleration.z + '<br />' +
+ element.innerHTML = 'Acceleration X: ' + acceleration.x + '<br />' +
+ 'Acceleration Y: ' + acceleration.y + '<br />' +
+ 'Acceleration Z: ' + acceleration.z + '<br />' +
'Timestamp: ' + acceleration.timestamp + '<br />';
}
@@ -109,6 +109,6 @@ Full Example
</head>
<body>
<div id="accelerometer">Waiting for accelerometer...</div>
- <button onclick="stopWatch();">Stop Watching</button>
+ <button onclick="stopWatch();">Stop Watching</button>
</body>
</html>
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/accelerometer/accelerometer.getCurrentAcceleration.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/accelerometer/accelerometer.getCurrentAcceleration.md b/docs/en/edge/cordova/accelerometer/accelerometer.getCurrentAcceleration.md
index f65d262..b93a4a3 100644
--- a/docs/en/edge/cordova/accelerometer/accelerometer.getCurrentAcceleration.md
+++ b/docs/en/edge/cordova/accelerometer/accelerometer.getCurrentAcceleration.md
@@ -72,16 +72,16 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
navigator.accelerometer.getCurrentAcceleration(onSuccess, onError);
}
-
+
// onSuccess: Get a snapshot of the current acceleration
//
function onSuccess(acceleration) {
@@ -90,7 +90,7 @@ Full Example
'Acceleration Z: ' + acceleration.z + '\n' +
'Timestamp: ' + acceleration.timestamp + '\n');
}
-
+
// onError: Failed to get the acceleration
//
function onError() {
@@ -110,4 +110,4 @@ iOS Quirks
- iOS doesn't recognize the concept of getting the current acceleration at any given point.
- You must watch the acceleration and capture the data at given time intervals.
-- Thus, the `getCurrentAcceleration` function yields the last value reported from a Cordova `watchAccelerometer` call.
+- Thus, the `getCurrentAcceleration` function yields the last value reported from a `watchAccelerometer` call.
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/accelerometer/accelerometer.watchAcceleration.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/accelerometer/accelerometer.watchAcceleration.md b/docs/en/edge/cordova/accelerometer/accelerometer.watchAcceleration.md
index e4cfb48..97510be 100644
--- a/docs/en/edge/cordova/accelerometer/accelerometer.watchAcceleration.md
+++ b/docs/en/edge/cordova/accelerometer/accelerometer.watchAcceleration.md
@@ -69,7 +69,7 @@ Quick Example
};
var options = { frequency: 3000 }; // Update every 3 seconds
-
+
var watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
Full Example
@@ -85,12 +85,12 @@ Full Example
// The watch id references the current `watchAcceleration`
var watchID = null;
-
- // Wait for Cordova to load
+
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
startWatch();
@@ -99,13 +99,13 @@ Full Example
// Start watching the acceleration
//
function startWatch() {
-
+
// Update acceleration every 3 seconds
var options = { frequency: 3000 };
-
+
watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
}
-
+
// Stop watching the acceleration
//
function stopWatch() {
@@ -114,14 +114,14 @@ Full Example
watchID = null;
}
}
-
+
// onSuccess: Get a snapshot of the current acceleration
//
function onSuccess(acceleration) {
var element = document.getElementById('accelerometer');
- element.innerHTML = 'Acceleration X: ' + acceleration.x + '<br />' +
- 'Acceleration Y: ' + acceleration.y + '<br />' +
- 'Acceleration Z: ' + acceleration.z + '<br />' +
+ element.innerHTML = 'Acceleration X: ' + acceleration.x + '<br />' +
+ 'Acceleration Y: ' + acceleration.y + '<br />' +
+ 'Acceleration Z: ' + acceleration.z + '<br />' +
'Timestamp: ' + acceleration.timestamp + '<br />';
}
@@ -138,11 +138,11 @@ Full Example
</body>
</html>
- iOS Quirks
+iOS Quirks
-------------
-- Cordova calls the success callback function at the interval
- requested, but restricts the range of requests to the device between
- 40ms and 1000ms. For example, if you request an interval of 3
- seconds, (3000ms), Cordova requests data from the device every 1
- second, but only executes the success callback every 3 seconds.
+The API calls the success callback function at the interval requested,
+but restricts the range of requests to the device between 40ms and
+1000ms. For example, if you request an interval of 3 seconds,
+(3000ms), the API requests data from the device every 1 second, but
+only executes the success callback every 3 seconds.
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/camera/camera.getPicture.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/camera/camera.getPicture.md b/docs/en/edge/cordova/camera/camera.getPicture.md
index 3fc21d6..53ff7a7 100644
--- a/docs/en/edge/cordova/camera/camera.getPicture.md
+++ b/docs/en/edge/cordova/camera/camera.getPicture.md
@@ -32,9 +32,9 @@ Description
-----------
The `camera.getPicture` function opens the device's default camera
-application that allows the user to take a picture. This behavior
-occurs by default, when `Camera.sourceType` equals
-`Camera.PictureSourceType.CAMERA`. Once the photo is taken, the
+application that allows users to snap pictures. This behavior occurs
+by default, when `Camera.sourceType` equals
+`Camera.PictureSourceType.CAMERA`. Once the user snaps the photo, the
camera application closes and the application is restored.
If `Camera.sourceType` is `Camera.PictureSourceType.PHOTOLIBRARY` or
@@ -55,7 +55,7 @@ You can do whatever you want with the encoded image or URI, for
example:
- Render the image in an `<img>` tag, as in the example below
-- Save the data locally (`LocalStorage`, [Lawnchair](http://brianleroux.github.com/lawnchair/), etc)
+- Save the data locally (`LocalStorage`, [Lawnchair](http://brianleroux.github.com/lawnchair/), etc.)
- Post the data to a remote server
__NOTE:__ Photo resolution on newer devices is quite good. Photos
@@ -146,12 +146,12 @@ Full Example
var pictureSource; // picture source
var destinationType; // sets the format of returned value
-
- // Wait for Cordova to connect with the device
+
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready",onDeviceReady,false);
-
- // Cordova is ready to be used!
+
+ // device APIs are available
//
function onDeviceReady() {
pictureSource=navigator.camera.PictureSourceType;
@@ -163,15 +163,15 @@ Full Example
function onPhotoDataSuccess(imageData) {
// Uncomment to view the base64-encoded image data
// console.log(imageData);
-
+
// Get image handle
//
var smallImage = document.getElementById('smallImage');
-
+
// Unhide image elements
//
smallImage.style.display = 'block';
-
+
// Show the captured photo
// The inline CSS rules are used to resize the image
//
@@ -183,15 +183,15 @@ Full Example
function onPhotoURISuccess(imageURI) {
// Uncomment to view the image file URI
// console.log(imageURI);
-
+
// Get image handle
//
var largeImage = document.getElementById('largeImage');
-
+
// Unhide image elements
//
largeImage.style.display = 'block';
-
+
// Show the captured photo
// The inline CSS rules are used to resize the image
//
@@ -213,7 +213,7 @@ Full Example
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 20, allowEdit: true,
destinationType: destinationType.DATA_URL });
}
-
+
// A button will call this function
//
function getPhoto(source) {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/camera/parameter/CameraPopoverOptions.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/camera/parameter/CameraPopoverOptions.md b/docs/en/edge/cordova/camera/parameter/CameraPopoverOptions.md
index c88c544..baff3d1 100644
--- a/docs/en/edge/cordova/camera/parameter/CameraPopoverOptions.md
+++ b/docs/en/edge/cordova/camera/parameter/CameraPopoverOptions.md
@@ -60,17 +60,21 @@ location.
Quick Example
-------------
- var popover = new CameraPopoverOptions(300,300,100,100,Camera.PopoverArrowDirection.ARROW_ANY);
- var options = { quality: 50, destinationType: Camera.DestinationType.DATA_URL,sourceType: Camera.PictureSource.SAVEDPHOTOALBUM, popoverOptions : popover };
-
+ var popover = new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY);
+ var options = {
+ quality : 50,
+ destinationType : Camera.DestinationType.DATA_URL,
+ sourceType : Camera.PictureSource.SAVEDPHOTOALBUM,
+ popoverOptions : popover
+ };
+
navigator.camera.getPicture(onSuccess, onFail, options);
-
+
function onSuccess(imageData) {
- var image = document.getElementById('myImage');
- image.src = "data:image/jpeg;base64," + imageData;
- }
-
- function onFail(message) {
- alert('Failed because: ' + message);
- }
-
+ var image = document.getElementById('myImage');
+ image.src = "data:image/jpeg;base64," + imageData;
+ }
+
+ function onFail(message) {
+ alert('Failed because: ' + message);
+ }
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/compass/compass.clearWatch.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/compass/compass.clearWatch.md b/docs/en/edge/cordova/compass/compass.clearWatch.md
index ee29909..991bd95 100755
--- a/docs/en/edge/cordova/compass/compass.clearWatch.md
+++ b/docs/en/edge/cordova/compass/compass.clearWatch.md
@@ -41,9 +41,9 @@ Quick Example
-------------
var watchID = navigator.compass.watchHeading(onSuccess, onError, options);
-
+
// ... later on ...
-
+
navigator.compass.clearWatch(watchID);
Full Example
@@ -59,12 +59,12 @@ Full Example
// The watch id references the current `watchHeading`
var watchID = null;
-
- // Wait for Cordova to load
+
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
startWatch();
@@ -73,13 +73,13 @@ Full Example
// Start watching the compass
//
function startWatch() {
-
+
// Update compass every 3 seconds
var options = { frequency: 3000 };
-
+
watchID = navigator.compass.watchHeading(onSuccess, onError, options);
}
-
+
// Stop watching the compass
//
function stopWatch() {
@@ -88,7 +88,7 @@ Full Example
watchID = null;
}
}
-
+
// onSuccess: Get the current heading
//
function onSuccess(heading) {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/compass/compass.getCurrentHeading.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/compass/compass.getCurrentHeading.md b/docs/en/edge/cordova/compass/compass.getCurrentHeading.md
index 89fd4b7..a5aef61 100755
--- a/docs/en/edge/cordova/compass/compass.getCurrentHeading.md
+++ b/docs/en/edge/cordova/compass/compass.getCurrentHeading.md
@@ -69,22 +69,22 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
navigator.compass.getCurrentHeading(onSuccess, onError);
}
-
+
// onSuccess: Get the current heading
//
function onSuccess(heading) {
alert('Heading: ' + heading.magneticHeading);
}
-
+
// onError: Failed to get the heading
//
function onError(compassError) {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/compass/compass.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/compass/compass.md b/docs/en/edge/cordova/compass/compass.md
index d85be8c..4edd5b9 100755
--- a/docs/en/edge/cordova/compass/compass.md
+++ b/docs/en/edge/cordova/compass/compass.md
@@ -28,8 +28,8 @@ Methods
- compass.getCurrentHeading
- compass.watchHeading
- compass.clearWatch
-- compass.watchHeadingFilter (obsolete)
-- compass.clearWatchFilter (obsolete)
+- compass.watchHeadingFilter (obsolete)
+- compass.clearWatchFilter (obsolete)
Arguments
---------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/compass/compass.watchHeading.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/compass/compass.watchHeading.md b/docs/en/edge/cordova/compass/compass.watchHeading.md
index ae59f8f..323616e 100755
--- a/docs/en/edge/cordova/compass/compass.watchHeading.md
+++ b/docs/en/edge/cordova/compass/compass.watchHeading.md
@@ -60,11 +60,13 @@ Quick Example
};
function onError(compassError) {
- alert('Compass error: ' + compassError.code);
+ alert('Compass error: ' + compassError.code);
};
- var options = { frequency: 3000 }; // Update every 3 seconds
-
+ var options = {
+ frequency: 3000
+ }; // Update every 3 seconds
+
var watchID = navigator.compass.watchHeading(onSuccess, onError, options);
Full Example
@@ -80,12 +82,12 @@ Full Example
// The watch id references the current `watchHeading`
var watchID = null;
-
- // Wait for Cordova to load
+
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
startWatch();
@@ -94,13 +96,13 @@ Full Example
// Start watching the compass
//
function startWatch() {
-
+
// Update compass every 3 seconds
var options = { frequency: 3000 };
-
+
watchID = navigator.compass.watchHeading(onSuccess, onError, options);
}
-
+
// Stop watching the compass
//
function stopWatch() {
@@ -109,7 +111,7 @@ Full Example
watchID = null;
}
}
-
+
// onSuccess: Get the current heading
//
function onSuccess(heading) {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/compass/compassError/compassError.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/compass/compassError/compassError.md b/docs/en/edge/cordova/compass/compassError/compassError.md
index 8862490..0c1769a 100644
--- a/docs/en/edge/cordova/compass/compassError/compassError.md
+++ b/docs/en/edge/cordova/compass/compassError/compassError.md
@@ -35,5 +35,5 @@ Constants
Description
-----------
-The `CompassError` object is returned to the user through the `compassError` callback function when an error occurs.
-
+When an error occurs, the `CompassError` object is passed as a
+parameter to a `compassError` callback function.
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/connection/connection.type.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/connection/connection.type.md b/docs/en/edge/cordova/connection/connection.type.md
index 341cf68..ead1586 100644
--- a/docs/en/edge/cordova/connection/connection.type.md
+++ b/docs/en/edge/cordova/connection/connection.type.md
@@ -45,20 +45,20 @@ Quick Example
function checkConnection() {
var networkState = navigator.connection.type;
-
+
var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
-
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+
alert('Connection type: ' + states[networkState]);
}
-
+
checkConnection();
Full Example
@@ -68,36 +68,36 @@ Full Example
<html>
<head>
<title>navigator.connection.type Example</title>
-
+
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
-
- // Wait for Cordova to load
+
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
-
- // Cordova is loaded and it is now safe to make calls Cordova methods
+
+ // device APIs are available
//
function onDeviceReady() {
checkConnection();
}
-
- function checkConnection() {
- var networkState = navigator.connection.type;
-
- var states = {};
- states[Connection.UNKNOWN] = 'Unknown connection';
- states[Connection.ETHERNET] = 'Ethernet connection';
- states[Connection.WIFI] = 'WiFi connection';
- states[Connection.CELL_2G] = 'Cell 2G connection';
- states[Connection.CELL_3G] = 'Cell 3G connection';
- states[Connection.CELL_4G] = 'Cell 4G connection';
- states[Connection.CELL] = 'Cell generic connection';
- states[Connection.NONE] = 'No network connection';
-
- alert('Connection type: ' + states[networkState]);
- }
-
+
+ function checkConnection() {
+ var networkState = navigator.connection.type;
+
+ var states = {};
+ states[Connection.UNKNOWN] = 'Unknown connection';
+ states[Connection.ETHERNET] = 'Ethernet connection';
+ states[Connection.WIFI] = 'WiFi connection';
+ states[Connection.CELL_2G] = 'Cell 2G connection';
+ states[Connection.CELL_3G] = 'Cell 3G connection';
+ states[Connection.CELL_4G] = 'Cell 4G connection';
+ states[Connection.CELL] = 'Cell generic connection';
+ states[Connection.NONE] = 'No network connection';
+
+ alert('Connection type: ' + states[networkState]);
+ }
+
</script>
</head>
<body>
@@ -108,10 +108,10 @@ Full Example
API Change
----------
-Prior to Cordova 2.3.0, the `Connection` object was accessed via
-`navigator.network.connection`. It was changed to
-`navigator.connection` in 2.3.0 to match the W3C specification. It's
-still available at its original location, but is deprecated and will
+Until Cordova 2.3.0, the `Connection` object was accessed via
+`navigator.network.connection`, after which it was changed to
+`navigator.connection` to match the W3C specification. It's still
+available at its original location, but is deprecated and will
eventually be removed.
iOS Quirks
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/contacts/Contact/contact.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/contacts/Contact/contact.md b/docs/en/edge/cordova/contacts/Contact/contact.md
index 00d958a..1b49d1f 100644
--- a/docs/en/edge/cordova/contacts/Contact/contact.md
+++ b/docs/en/edge/cordova/contacts/Contact/contact.md
@@ -37,7 +37,7 @@ Properties
- __birthday__: The birthday of the contact. _(Date)_
- __note__: A note about the contact. _(DOMString)_
- __photos__: An array of the contact's photos. _(ContactField[])_
-- __categories__: An array of all the contact's user-defined categories. _(ContactField[])_
+- __categories__: An array of all the user-defined categories associated with the contact. _(ContactField[])_
- __urls__: An array of web pages associated with the contact. _(ContactField[])_
Methods
@@ -50,7 +50,7 @@ Methods
Details
-------
-The `Contact` object represents a user contact. Contacts can be
+The `Contact` object represents a user's contact. Contacts can be
created, stored, or removed from the device contacts database.
Contacts can also be retrieved (individually or in bulk) from the
database by invoking the `contacts.find` method.
@@ -72,36 +72,36 @@ Supported Platforms
Save Quick Example
------------------
- function onSuccess(contact) {
- alert("Save Success");
- };
+ function onSuccess(contact) {
+ alert("Save Success");
+ };
- function onError(contactError) {
- alert("Error = " + contactError.code);
- };
+ function onError(contactError) {
+ alert("Error = " + contactError.code);
+ };
- // create a new contact object
+ // create a new contact object
var contact = navigator.contacts.create();
- contact.displayName = "Plumber";
- contact.nickname = "Plumber"; //specify both to support all devices
-
- // populate some fields
- var name = new ContactName();
- name.givenName = "Jane";
- name.familyName = "Doe";
- contact.name = name;
-
- // save to device
- contact.save(onSuccess,onError);
+ contact.displayName = "Plumber";
+ contact.nickname = "Plumber"; // specify both to support all devices
+
+ // populate some fields
+ var name = new ContactName();
+ name.givenName = "Jane";
+ name.familyName = "Doe";
+ contact.name = name;
+
+ // save to device
+ contact.save(onSuccess,onError);
Clone Quick Example
-------------------
- // clone the contact object
- var clone = contact.clone();
- clone.name.givenName = "John";
- console.log("Original contact name = " + contact.name.givenName);
- console.log("Cloned contact name = " + clone.name.givenName);
+ // clone the contact object
+ var clone = contact.clone();
+ clone.name.givenName = "John";
+ console.log("Original contact name = " + contact.name.givenName);
+ console.log("Cloned contact name = " + clone.name.givenName);
Remove Quick Example
--------------------
@@ -114,8 +114,8 @@ Remove Quick Example
alert("Error = " + contactError.code);
};
- // remove the contact from the device
- contact.remove(onSuccess,onError);
+ // remove the contact from the device
+ contact.remove(onSuccess,onError);
Full Example
------------
@@ -128,57 +128,57 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
- // create
- var contact = navigator.contacts.create();
- contact.displayName = "Plumber";
- contact.nickname = "Plumber"; //specify both to support all devices
- var name = new ContactName();
- name.givenName = "Jane";
- name.familyName = "Doe";
- contact.name = name;
-
- // save
- contact.save(onSaveSuccess,onSaveError);
-
- // clone
- var clone = contact.clone();
- clone.name.givenName = "John";
- console.log("Original contact name = " + contact.name.givenName);
- console.log("Cloned contact name = " + clone.name.givenName);
-
- // remove
- contact.remove(onRemoveSuccess,onRemoveError);
+ // create
+ var contact = navigator.contacts.create();
+ contact.displayName = "Plumber";
+ contact.nickname = "Plumber"; // specify both to support all devices
+ var name = new ContactName();
+ name.givenName = "Jane";
+ name.familyName = "Doe";
+ contact.name = name;
+
+ // save
+ contact.save(onSaveSuccess,onSaveError);
+
+ // clone
+ var clone = contact.clone();
+ clone.name.givenName = "John";
+ console.log("Original contact name = " + contact.name.givenName);
+ console.log("Cloned contact name = " + clone.name.givenName);
+
+ // remove
+ contact.remove(onRemoveSuccess,onRemoveError);
}
-
+
// onSaveSuccess: Get a snapshot of the current contacts
//
function onSaveSuccess(contact) {
- alert("Save Success");
+ alert("Save Success");
}
-
+
// onSaveError: Failed to get the contacts
//
function onSaveError(contactError) {
- alert("Error = " + contactError.code);
+ alert("Error = " + contactError.code);
}
-
+
// onRemoveSuccess: Get a snapshot of the current contacts
//
function onRemoveSuccess(contacts) {
- alert("Removal Success");
+ alert("Removal Success");
}
-
+
// onRemoveError: Failed to get the contacts
//
function onRemoveError(contactError) {
- alert("Error = " + contactError.code);
+ alert("Error = " + contactError.code);
}
</script>
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/contacts/ContactAddress/contactaddress.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/contacts/ContactAddress/contactaddress.md b/docs/en/edge/cordova/contacts/ContactAddress/contactaddress.md
index 124e141..22983e8 100644
--- a/docs/en/edge/cordova/contacts/ContactAddress/contactaddress.md
+++ b/docs/en/edge/cordova/contacts/ContactAddress/contactaddress.md
@@ -53,20 +53,21 @@ Supported Platforms
Quick Example
-------------
- // display the address information for all contacts
+ // display the address information for all contacts
+
function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- for (var j=0; j<contacts[i].addresses.length; j++) {
- alert("Pref: " + contacts[i].addresses[j].pref + "\n" +
- "Type: " + contacts[i].addresses[j].type + "\n" +
- "Formatted: " + contacts[i].addresses[j].formatted + "\n" +
- "Street Address: " + contacts[i].addresses[j].streetAddress + "\n" +
- "Locality: " + contacts[i].addresses[j].locality + "\n" +
- "Region: " + contacts[i].addresses[j].region + "\n" +
- "Postal Code: " + contacts[i].addresses[j].postalCode + "\n" +
- "Country: " + contacts[i].addresses[j].country);
- }
- }
+ for (var i = 0; i < contacts.length; i++) {
+ for (var j = 0; j < contacts[i].addresses.length; j++) {
+ alert("Pref: " + contacts[i].addresses[j].pref + "\n" +
+ "Type: " + contacts[i].addresses[j].type + "\n" +
+ "Formatted: " + contacts[i].addresses[j].formatted + "\n" +
+ "Street Address: " + contacts[i].addresses[j].streetAddress + "\n" +
+ "Locality: " + contacts[i].addresses[j].locality + "\n" +
+ "Region: " + contacts[i].addresses[j].region + "\n" +
+ "Postal Code: " + contacts[i].addresses[j].postalCode + "\n" +
+ "Country: " + contacts[i].addresses[j].country);
+ }
+ }
};
function onError(contactError) {
@@ -75,8 +76,8 @@ Quick Example
// find all contacts
var options = new ContactFindOptions();
- options.filter="";
- var filter = ["displayName","addresses"];
+ options.filter = "";
+ var filter = ["displayName", "addresses"];
navigator.contacts.find(filter, onSuccess, onError, options);
Full Example
@@ -90,38 +91,38 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
- // find all contacts
- var options = new ContactFindOptions();
- options.filter="";
- var filter = ["displayName","addresses"];
- navigator.contacts.find(filter, onSuccess, onError, options);
+ // find all contacts
+ var options = new ContactFindOptions();
+ options.filter = "";
+ var filter = ["displayName", "addresses"];
+ navigator.contacts.find(filter, onSuccess, onError, options);
}
-
+
// onSuccess: Get a snapshot of the current contacts
//
- function onSuccess(contacts) {
- // display the address information for all contacts
- for (var i=0; i<contacts.length; i++) {
- for (var j=0; j<contacts[i].addresses.length; j++) {
- alert("Pref: " + contacts[i].addresses[j].pref + "\n" +
- "Type: " + contacts[i].addresses[j].type + "\n" +
- "Formatted: " + contacts[i].addresses[j].formatted + "\n" +
- "Street Address: " + contacts[i].addresses[j].streetAddress + "\n" +
- "Locality: " + contacts[i].addresses[j].locality + "\n" +
- "Region: " + contacts[i].addresses[j].region + "\n" +
- "Postal Code: " + contacts[i].addresses[j].postalCode + "\n" +
- "Country: " + contacts[i].addresses[j].country);
- }
- }
- };
-
+ function onSuccess(contacts) {
+ // display the address information for all contacts
+ for (var i = 0; i < contacts.length; i++) {
+ for (var j = 0; j < contacts[i].addresses.length; j++) {
+ alert("Pref: " + contacts[i].addresses[j].pref + "\n" +
+ "Type: " + contacts[i].addresses[j].type + "\n" +
+ "Formatted: " + contacts[i].addresses[j].formatted + "\n" +
+ "Street Address: " + contacts[i].addresses[j].streetAddress + "\n" +
+ "Locality: " + contacts[i].addresses[j].locality + "\n" +
+ "Region: " + contacts[i].addresses[j].region + "\n" +
+ "Postal Code: " + contacts[i].addresses[j].postalCode + "\n" +
+ "Country: " + contacts[i].addresses[j].country);
+ }
+ }
+ };
+
// onError: Failed to get the contacts
//
function onError(contactError) {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/contacts/ContactField/contactfield.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/contacts/ContactField/contactfield.md b/docs/en/edge/cordova/contacts/ContactField/contactfield.md
index f14e735..eaf988f 100644
--- a/docs/en/edge/cordova/contacts/ContactField/contactfield.md
+++ b/docs/en/edge/cordova/contacts/ContactField/contactfield.md
@@ -45,10 +45,10 @@ In most instances, there are no pre-determined values for a
number can specify __type__ values of _home_, _work_, _mobile_,
_iPhone_, or any other value that is supported by a particular device
platform's contact database. However, for the `Contact` __photos__
-field, Cordova uses the __type__ field to indicate the format of the
-returned image. Cordova returns a __type__ of __url__ when the
-__value__ attribute contains a URL to the photo image, or _base64_
-when the __value__ contains a base64-encoded image string.
+field, the __type__ field indicates the format of the returned image:
+__url__ when the __value__ attribute contains a URL to the photo
+image, or _base64_ when the __value__ contains a base64-encoded image
+string.
Supported Platforms
-------------------
@@ -63,18 +63,18 @@ Supported Platforms
Quick Example
-------------
- // create a new contact
- var contact = navigator.contacts.create();
-
- // store contact phone numbers in ContactField[]
- var phoneNumbers = [];
- phoneNumbers[0] = new ContactField('work', '212-555-1234', false);
- phoneNumbers[1] = new ContactField('mobile', '917-555-5432', true); // preferred number
- phoneNumbers[2] = new ContactField('home', '203-555-7890', false);
- contact.phoneNumbers = phoneNumbers;
-
- // save the contact
- contact.save();
+ // create a new contact
+ var contact = navigator.contacts.create();
+
+ // store contact phone numbers in ContactField[]
+ var phoneNumbers = [];
+ phoneNumbers[0] = new ContactField('work', '212-555-1234', false);
+ phoneNumbers[1] = new ContactField('mobile', '917-555-5432', true); // preferred number
+ phoneNumbers[2] = new ContactField('home', '203-555-7890', false);
+ contact.phoneNumbers = phoneNumbers;
+
+ // save the contact
+ contact.save();
Full Example
------------
@@ -87,46 +87,47 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
+
function onDeviceReady() {
- // create a new contact
- var contact = navigator.contacts.create();
-
- // store contact phone numbers in ContactField[]
- var phoneNumbers = [];
- phoneNumbers[0] = new ContactField('work', '212-555-1234', false);
- phoneNumbers[1] = new ContactField('mobile', '917-555-5432', true); // preferred number
- phoneNumbers[2] = new ContactField('home', '203-555-7890', false);
- contact.phoneNumbers = phoneNumbers;
-
- // save the contact
- contact.save();
-
- // search contacts, returning display name and phone numbers
- var options = new ContactFindOptions();
- options.filter="";
- filter = ["displayName","phoneNumbers"];
- navigator.contacts.find(filter, onSuccess, onError, options);
+ // create a new contact
+ var contact = navigator.contacts.create();
+
+ // store contact phone numbers in ContactField[]
+ var phoneNumbers = [];
+ phoneNumbers[0] = new ContactField('work', '212-555-1234', false);
+ phoneNumbers[1] = new ContactField('mobile', '917-555-5432', true); // preferred number
+ phoneNumbers[2] = new ContactField('home', '203-555-7890', false);
+ contact.phoneNumbers = phoneNumbers;
+
+ // save the contact
+ contact.save();
+
+ // search contacts, returning display name and phone numbers
+ var options = new ContactFindOptions();
+ options.filter = "";
+ filter = ["displayName", "phoneNumbers"];
+ navigator.contacts.find(filter, onSuccess, onError, options);
}
-
+
// onSuccess: Get a snapshot of the current contacts
//
- function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- // display phone numbers
- for (var j=0; j<contacts[i].phoneNumbers.length; j++) {
- alert("Type: " + contacts[i].phoneNumbers[j].type + "\n" +
- "Value: " + contacts[i].phoneNumbers[j].value + "\n" +
- "Preferred: " + contacts[i].phoneNumbers[j].pref);
- }
- }
- };
-
+ function onSuccess(contacts) {
+ for (var i = 0; i < contacts.length; i++) {
+ // display phone numbers
+ for (var j = 0; j < contacts[i].phoneNumbers.length; j++) {
+ alert("Type: " + contacts[i].phoneNumbers[j].type + "\n" +
+ "Value: " + contacts[i].phoneNumbers[j].value + "\n" +
+ "Preferred: " + contacts[i].phoneNumbers[j].pref);
+ }
+ }
+ };
+
// onError: Failed to get the contacts
//
function onError(contactError) {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/contacts/ContactFindOptions/contactfindoptions.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/contacts/ContactFindOptions/contactfindoptions.md b/docs/en/edge/cordova/contacts/ContactFindOptions/contactfindoptions.md
index 522111a..abdf600 100644
--- a/docs/en/edge/cordova/contacts/ContactFindOptions/contactfindoptions.md
+++ b/docs/en/edge/cordova/contacts/ContactFindOptions/contactfindoptions.md
@@ -41,25 +41,25 @@ Supported Platforms
Quick Example
-------------
- // success callback
+ // success callback
function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- alert(contacts[i].displayName);
- }
+ for (var i=0; i<contacts.length; i++) {
+ alert(contacts[i].displayName);
+ }
};
- // error callback
+ // error callback
function onError(contactError) {
alert('onError!');
};
- // specify contact search criteria
+ // specify contact search criteria
var options = new ContactFindOptions();
- options.filter=""; // empty search string returns all contacts
- options.multiple=true; // return multiple results
- filter = ["displayName"]; // return contact.displayName field
-
- // find contacts
+ options.filter=""; // empty search string returns all contacts
+ options.multiple=true; // return multiple results
+ filter = ["displayName"]; // return contact.displayName field
+
+ // find contacts
navigator.contacts.find(filter, onSuccess, onError, options);
Full Example
@@ -73,31 +73,31 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
- // specify contact search criteria
- var options = new ContactFindOptions();
- options.filter=""; // empty search string returns all contacts
- options.multiple=true; // return multiple results
- filter = ["displayName"]; // return contact.displayName field
-
- // find contacts
- navigator.contacts.find(filter, onSuccess, onError, options);
+ // specify contact search criteria
+ var options = new ContactFindOptions();
+ options.filter = ""; // empty search string returns all contacts
+ options.multiple = true; // return multiple results
+ filter = ["displayName"]; // return contact.displayName field
+
+ // find contacts
+ navigator.contacts.find(filter, onSuccess, onError, options);
}
-
+
// onSuccess: Get a snapshot of the current contacts
//
- function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- alert(contacts[i].displayName);
- }
- };
-
+ function onSuccess(contacts) {
+ for (var i=0; i<contacts.length; i++) {
+ alert(contacts[i].displayName);
+ }
+ };
+
// onError: Failed to get the contacts
//
function onError(contactError) {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/contacts/ContactName/contactname.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/contacts/ContactName/contactname.md b/docs/en/edge/cordova/contacts/ContactName/contactname.md
index 3702ab7..6bae487 100644
--- a/docs/en/edge/cordova/contacts/ContactName/contactname.md
+++ b/docs/en/edge/cordova/contacts/ContactName/contactname.md
@@ -51,14 +51,14 @@ Quick Example
-------------
function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- alert("Formatted: " + contacts[i].name.formatted + "\n" +
- "Family Name: " + contacts[i].name.familyName + "\n" +
- "Given Name: " + contacts[i].name.givenName + "\n" +
- "Middle Name: " + contacts[i].name.middleName + "\n" +
- "Suffix: " + contacts[i].name.honorificSuffix + "\n" +
- "Prefix: " + contacts[i].name.honorificSuffix);
- }
+ for (var i = 0; i < contacts.length; i++) {
+ alert("Formatted: " + contacts[i].name.formatted + "\n" +
+ "Family Name: " + contacts[i].name.familyName + "\n" +
+ "Given Name: " + contacts[i].name.givenName + "\n" +
+ "Middle Name: " + contacts[i].name.middleName + "\n" +
+ "Suffix: " + contacts[i].name.honorificSuffix + "\n" +
+ "Prefix: " + contacts[i].name.honorificSuffix);
+ }
};
function onError(contactError) {
@@ -66,8 +66,8 @@ Quick Example
};
var options = new ContactFindOptions();
- options.filter="";
- filter = ["displayName","name"];
+ options.filter = "";
+ filter = ["displayName", "name"];
navigator.contacts.find(filter, onSuccess, onError, options);
Full Example
@@ -81,32 +81,32 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
- var options = new ContactFindOptions();
- options.filter="";
- filter = ["displayName","name"];
- navigator.contacts.find(filter, onSuccess, onError, options);
+ var options = new ContactFindOptions();
+ options.filter="";
+ filter = ["displayName","name"];
+ navigator.contacts.find(filter, onSuccess, onError, options);
}
-
+
// onSuccess: Get a snapshot of the current contacts
//
- function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- alert("Formatted: " + contacts[i].name.formatted + "\n" +
- "Family Name: " + contacts[i].name.familyName + "\n" +
- "Given Name: " + contacts[i].name.givenName + "\n" +
- "Middle Name: " + contacts[i].name.middleName + "\n" +
- "Suffix: " + contacts[i].name.honorificSuffix + "\n" +
- "Prefix: " + contacts[i].name.honorificPrefix);
- }
- };
-
+ function onSuccess(contacts) {
+ for (var i = 0; i < contacts.length; i ++) {
+ alert("Formatted: " + contacts[i].name.formatted + "\n" +
+ "Family Name: " + contacts[i].name.familyName + "\n" +
+ "Given Name: " + contacts[i].name.givenName + "\n" +
+ "Middle Name: " + contacts[i].name.middleName + "\n" +
+ "Suffix: " + contacts[i].name.honorificSuffix + "\n" +
+ "Prefix: " + contacts[i].name.honorificPrefix);
+ }
+ };
+
// onError: Failed to get the contacts
//
function onError(contactError) {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/contacts/ContactOrganization/contactorganization.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/contacts/ContactOrganization/contactorganization.md b/docs/en/edge/cordova/contacts/ContactOrganization/contactorganization.md
index 475a2fd..8975667 100644
--- a/docs/en/edge/cordova/contacts/ContactOrganization/contactorganization.md
+++ b/docs/en/edge/cordova/contacts/ContactOrganization/contactorganization.md
@@ -51,15 +51,15 @@ Quick Example
-------------
function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- for (var j=0; j<contacts[i].organizations.length; j++) {
- alert("Pref: " + contacts[i].organizations[j].pref + "\n" +
- "Type: " + contacts[i].organizations[j].type + "\n" +
- "Name: " + contacts[i].organizations[j].name + "\n" +
- "Department: " + contacts[i].organizations[j].department + "\n" +
- "Title: " + contacts[i].organizations[j].title);
- }
- }
+ for (var i = 0; i < contacts.length; i++) {
+ for (var j = 0; j < contacts[i].organizations.length; j++) {
+ alert("Pref: " + contacts[i].organizations[j].pref + "\n" +
+ "Type: " + contacts[i].organizations[j].type + "\n" +
+ "Name: " + contacts[i].organizations[j].name + "\n" +
+ "Department: " + contacts[i].organizations[j].department + "\n" +
+ "Title: " + contacts[i].organizations[j].title);
+ }
+ }
};
function onError(contactError) {
@@ -67,8 +67,8 @@ Quick Example
};
var options = new ContactFindOptions();
- options.filter="";
- filter = ["displayName","organizations"];
+ options.filter = "";
+ filter = ["displayName", "organizations"];
navigator.contacts.find(filter, onSuccess, onError, options);
Full Example
@@ -82,33 +82,33 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
- var options = new ContactFindOptions();
- options.filter="";
- filter = ["displayName","organizations"];
- navigator.contacts.find(filter, onSuccess, onError, options);
+ var options = new ContactFindOptions();
+ options.filter="";
+ filter = ["displayName","organizations"];
+ navigator.contacts.find(filter, onSuccess, onError, options);
}
-
+
// onSuccess: Get a snapshot of the current contacts
//
- function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- for (var j=0; j<contacts[i].organizations.length; j++) {
- alert("Pref: " + contacts[i].organizations[j].pref + "\n" +
- "Type: " + contacts[i].organizations[j].type + "\n" +
- "Name: " + contacts[i].organizations[j].name + "\n" +
- "Department: " + contacts[i].organizations[j].department + "\n" +
- "Title: " + contacts[i].organizations[j].title);
- }
- }
- };
-
+ function onSuccess(contacts) {
+ for (var i = 0; i < contacts.length; i++) {
+ for (var j = 0; j < contacts[i].organizations.length; j++) {
+ alert("Pref: " + contacts[i].organizations[j].pref + "\n" +
+ "Type: " + contacts[i].organizations[j].type + "\n" +
+ "Name: " + contacts[i].organizations[j].name + "\n" +
+ "Department: " + contacts[i].organizations[j].department + "\n" +
+ "Title: " + contacts[i].organizations[j].title);
+ }
+ }
+ };
+
// onError: Failed to get the contacts
//
function onError(contactError) {
@@ -122,7 +122,7 @@ Full Example
<p>Find Contacts</p>
</body>
</html>
-
+
Android 2.X Quirks
------------------
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/contacts/contacts.create.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/contacts/contacts.create.md b/docs/en/edge/cordova/contacts/contacts.create.md
index 6552884..54f0558 100644
--- a/docs/en/edge/cordova/contacts/contacts.create.md
+++ b/docs/en/edge/cordova/contacts/contacts.create.md
@@ -57,18 +57,18 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
- var myContact = navigator.contacts.create({"displayName": "Test User"});
- myContact.note = "This contact has a note.";
- console.log("The contact, " + myContact.displayName + ", note: " + myContact.note);
+ var myContact = navigator.contacts.create({"displayName": "Test User"});
+ myContact.note = "This contact has a note.";
+ console.log("The contact, " + myContact.displayName + ", note: " + myContact.note);
}
-
+
</script>
</head>
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/contacts/contacts.find.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/contacts/contacts.find.md b/docs/en/edge/cordova/contacts/contacts.find.md
index c6cb70f..fd8ec3e 100644
--- a/docs/en/edge/cordova/contacts/contacts.find.md
+++ b/docs/en/edge/cordova/contacts/contacts.find.md
@@ -76,10 +76,10 @@ Quick Example
};
// find all contacts with 'Bob' in any name field
- var options = new ContactFindOptions();
- options.filter="Bob";
- options.multiple=true;
- var fields = ["displayName", "name"];
+ var options = new ContactFindOptions();
+ options.filter = "Bob";
+ options.multiple = true;
+ var fields = ["displayName", "name"];
navigator.contacts.find(fields, onSuccess, onError, options);
Full Example
@@ -87,45 +87,42 @@ Full Example
<!DOCTYPE html>
<html>
- <head>
- <title>Contact Example</title>
-
- <script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
- <script type="text/javascript" charset="utf-8">
-
- // Wait for Cordova to load
- //
- document.addEventListener("deviceready", onDeviceReady, false);
-
- // Cordova is ready
- //
- function onDeviceReady() {
- // find all contacts with 'Bob' in any name field
- var options = new ContactFindOptions();
- options.filter="Bob";
- var fields = ["displayName", "name"];
- navigator.contacts.find(fields, onSuccess, onError, options);
- }
-
- // onSuccess: Get a snapshot of the current contacts
- //
- function onSuccess(contacts) {
- for (var i=0; i<contacts.length; i++) {
- console.log("Display Name = " + contacts[i].displayName);
- }
- }
-
- // onError: Failed to get the contacts
- //
- function onError(contactError) {
- alert('onError!');
- }
-
- </script>
- </head>
- <body>
- <h1>Example</h1>
- <p>Find Contacts</p>
- </body>
+ <head>
+ <title>Contact Example</title>
+ <script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
+ <script type="text/javascript" charset="utf-8">
+
+ // Wait for device API libraries to load
+ document.addEventListener("deviceready", onDeviceReady, false);
+
+ // device APIs are available
+
+ function onDeviceReady() {
+ // find all contacts with 'Bob' in any name field
+ var options = new ContactFindOptions();
+ options.filter = "Bob";
+ var fields = ["displayName", "name"];
+ navigator.contacts.find(fields, onSuccess, onError, options);
+ }
+
+ // onSuccess: Get a snapshot of the current contacts
+
+ function onSuccess(contacts) {
+ for (var i = 0; i < contacts.length; i++) {
+ console.log("Display Name = " + contacts[i].displayName);
+ }
+ }
+
+ // onError: Failed to get the contacts
+
+ function onError(contactError) {
+ alert('onError!');
+ }
+ </script>
+ </head>
+
+ <body>
+ <h1>Example</h1>
+ <p>Find Contacts</p>
+ </body>
</html>
-
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/device/device.cordova.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.cordova.md b/docs/en/edge/cordova/device/device.cordova.md
index 7156fba..b848ad4 100644
--- a/docs/en/edge/cordova/device/device.cordova.md
+++ b/docs/en/edge/cordova/device/device.cordova.md
@@ -56,15 +56,15 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
-
+
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
'Device Cordova: ' + device.cordova + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/device/device.model.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.model.md b/docs/en/edge/cordova/device/device.model.md
index d1b76c5..abea756 100644
--- a/docs/en/edge/cordova/device/device.model.md
+++ b/docs/en/edge/cordova/device/device.model.md
@@ -64,20 +64,20 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
-
+
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
- 'Device Cordova: ' + device.cordova + '<br />' +
+ 'Device Cordova: ' + device.cordova + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
'Device UUID: ' + device.uuid + '<br />' +
- 'Device Model: ' + device.model + '<br />' +
+ 'Device Model: ' + device.model + '<br />' +
'Device Version: ' + device.version + '<br />';
}
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/device/device.name.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.name.md b/docs/en/edge/cordova/device/device.name.md
index f671e8c..00cec23 100644
--- a/docs/en/edge/cordova/device/device.name.md
+++ b/docs/en/edge/cordova/device/device.name.md
@@ -66,20 +66,20 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
-
+
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
- 'Device Cordova: ' + device.cordova + '<br />' +
+ 'Device Cordova: ' + device.cordova + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
'Device UUID: ' + device.uuid + '<br />' +
- 'Device Model: ' + device.model + '<br />' +
+ 'Device Model: ' + device.model + '<br />' +
'Device Version: ' + device.version + '<br />';
}
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/device/device.platform.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.platform.md b/docs/en/edge/cordova/device/device.platform.md
index 893b02f..5f2baab 100644
--- a/docs/en/edge/cordova/device/device.platform.md
+++ b/docs/en/edge/cordova/device/device.platform.md
@@ -59,15 +59,15 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
-
+
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
'Device Cordova: ' + device.cordova + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/device/device.uuid.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.uuid.md b/docs/en/edge/cordova/device/device.uuid.md
index 0f9c073..9eaa7c9 100644
--- a/docs/en/edge/cordova/device/device.uuid.md
+++ b/docs/en/edge/cordova/device/device.uuid.md
@@ -74,15 +74,15 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
-
+
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
'Device Cordova: ' + device.cordova + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/device/device.version.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/device/device.version.md b/docs/en/edge/cordova/device/device.version.md
index 4823491..09aa71c 100644
--- a/docs/en/edge/cordova/device/device.version.md
+++ b/docs/en/edge/cordova/device/device.version.md
@@ -63,15 +63,15 @@ Full Example
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Wait for Cordova to load
+ // Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
- // Cordova is ready
+ // device APIs are available
//
function onDeviceReady() {
var element = document.getElementById('deviceProperties');
-
+
element.innerHTML = 'Device Name: ' + device.name + '<br />' +
'Device Cordova: ' + device.cordova + '<br />' +
'Device Platform: ' + device.platform + '<br />' +
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/events/events.backbutton.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/events/events.backbutton.md b/docs/en/edge/cordova/events/events.backbutton.md
index 4208187..015472a 100644
--- a/docs/en/edge/cordova/events/events.backbutton.md
+++ b/docs/en/edge/cordova/events/events.backbutton.md
@@ -29,9 +29,9 @@ Details
To override the default back-button behavior, register an event
listener for the `backbutton` event, typically by calling
-`document.addEventListener` once you receive the Cordova `deviceready`
-event. It is no longer necessary to call any other method to override
-the back-button behavior.
+`document.addEventListener` once you receive the `deviceready` event.
+It is no longer necessary to call any other method to override the
+back-button behavior.
Supported Platforms
-------------------
@@ -55,28 +55,25 @@ Full Example
<!DOCTYPE html>
<html>
<head>
- <title>Cordova Back Button Example</title>
+ <title>Back Button Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Call onDeviceReady when Cordova is loaded.
- //
- // At this point, the document has loaded but cordova-x.x.x.js has not.
- // When Cordova is loaded and talking with the native device,
- // it will call the event `deviceready`.
+
+ // Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
- // Cordova is loaded and it is now safe to call Cordova methods
+ // device APIs are available
//
function onDeviceReady() {
// Register the event listener
document.addEventListener("backbutton", onBackKeyDown, false);
}
-
+
// Handle the back button
//
function onBackKeyDown() {
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/events/events.batterycritical.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/events/events.batterycritical.md b/docs/en/edge/cordova/events/events.batterycritical.md
index 5ebea4b..aedf22f 100644
--- a/docs/en/edge/cordova/events/events.batterycritical.md
+++ b/docs/en/edge/cordova/events/events.batterycritical.md
@@ -37,8 +37,8 @@ properties:
- __level__: The percentage of battery charge (0-100). _(Number)_
- __isPlugged__: A boolean that indicates whether the device is plugged in. _(Boolean)_
-Applications typically should use `window.addEventListener` to
-attach an event listener once the Cordova `deviceready` event fires.
+Applications typically should use `window.addEventListener` to attach
+an event listener once the `deviceready` event fires.
Supported Platforms
-------------------
@@ -55,7 +55,7 @@ Quick Example
function onBatteryCritical(info) {
// Handle the battery critical event
- alert("Battery Level Critical " + info.level + "%\nRecharge Soon!");
+ alert("Battery Level Critical " + info.level + "%\nRecharge Soon!");
}
Full Example
@@ -64,33 +64,29 @@ Full Example
<!DOCTYPE html>
<html>
<head>
- <title>Cordova Battery Critical Example</title>
+ <title>Battery Critical Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Call onDeviceReady when Cordova is loaded.
+ // Wait for device API libraries to load
//
- // At this point, the document has loaded but cordova-x.x.x.js has not.
- // When Cordova is loaded and talking with the native device,
- // it will call the event `deviceready`.
- //
- function onLoad() {
- document.addEventListener("deviceready", onDeviceReady, false);
- }
+ function onLoad() {
+ document.addEventListener("deviceready", onDeviceReady, false);
+ }
- // Cordova is loaded and it is now safe to make calls Cordova methods
+ // device APIs are available
//
function onDeviceReady() {
- window.addEventListener("batterycritical", onBatteryCritical, false);
+ window.addEventListener("batterycritical", onBatteryCritical, false);
}
// Handle the batterycritical event
//
function onBatteryCritical(info) {
- alert("Battery Level Critical " + info.level + "%\nRecharge Soon!");
+ alert("Battery Level Critical " + info.level + "%\nRecharge Soon!");
}
-
+
</script>
</head>
<body onload="onLoad()">
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/events/events.batterylow.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/events/events.batterylow.md b/docs/en/edge/cordova/events/events.batterylow.md
index b156454..b65716c 100644
--- a/docs/en/edge/cordova/events/events.batterylow.md
+++ b/docs/en/edge/cordova/events/events.batterylow.md
@@ -37,7 +37,7 @@ properties:
- __isPlugged__: A boolean that indicates whether the device is plugged in. _(Boolean)_
Applications typically should use `document.addEventListener` to
-attach an event listener once the Cordova `deviceready` event fires.
+attach an event listener once the `deviceready` event fires.
Supported Platforms
-------------------
@@ -54,7 +54,7 @@ Quick Example
function onBatteryLow(info) {
// Handle the battery low event
- alert("Battery Level Low " + info.level + "%");
+ alert("Battery Level Low " + info.level + "%");
}
Full Example
@@ -63,33 +63,29 @@ Full Example
<!DOCTYPE html>
<html>
<head>
- <title>Cordova Device Ready Example</title>
+ <title>Device Ready Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Call onDeviceReady when Cordova is loaded.
+ // Wait for device API libraries to load
//
- // At this point, the document has loaded but cordova-x.x.x.js has not.
- // When Cordova is loaded and talking with the native device,
- // it will call the event `deviceready`.
- //
- function onLoad() {
- document.addEventListener("deviceready", onDeviceReady, false);
- }
+ function onLoad() {
+ document.addEventListener("deviceready", onDeviceReady, false);
+ }
- // Cordova is loaded and it is now safe to make calls Cordova methods
+ // device APIs are available
//
function onDeviceReady() {
- window.addEventListener("batterylow", onBatteryLow, false);
+ window.addEventListener("batterylow", onBatteryLow, false);
}
// Handle the batterylow event
//
function onBatteryLow(info) {
- alert("Battery Level Low " + info.level + "%");
+ alert("Battery Level Low " + info.level + "%");
}
-
+
</script>
</head>
<body onload="onLoad()">
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/events/events.batterystatus.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/events/events.batterystatus.md b/docs/en/edge/cordova/events/events.batterystatus.md
index 728aca2..9619c85 100644
--- a/docs/en/edge/cordova/events/events.batterystatus.md
+++ b/docs/en/edge/cordova/events/events.batterystatus.md
@@ -37,7 +37,7 @@ properties:
- __isPlugged__: A boolean that indicates whether the device is plugged in. _(Boolean)_
Applications typically should use `window.addEventListener` to
-attach an event listener once the Cordova `deviceready` event fires.
+attach an event listener once the `deviceready` event fires.
Supported Platforms
-------------------
@@ -62,7 +62,7 @@ Quick Example
function onBatteryStatus(info) {
// Handle the online event
- console.log("Level: " + info.level + " isPlugged: " + info.isPlugged);
+ console.log("Level: " + info.level + " isPlugged: " + info.isPlugged);
}
Full Example
@@ -71,33 +71,29 @@ Full Example
<!DOCTYPE html>
<html>
<head>
- <title>Cordova Device Ready Example</title>
+ <title>Device Ready Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Call onDeviceReady when Cordova is loaded.
+ // Wait for device API libraries to load
//
- // At this point, the document has loaded but cordova-x.x.x.js has not.
- // When Cordova is loaded and talking with the native device,
- // it will call the event `deviceready`.
- //
- function onLoad() {
- document.addEventListener("deviceready", onDeviceReady, false);
- }
+ function onLoad() {
+ document.addEventListener("deviceready", onDeviceReady, false);
+ }
- // Cordova is loaded and it is now safe to make calls Cordova methods
+ // device APIs are available
//
function onDeviceReady() {
- window.addEventListener("batterystatus", onBatteryStatus, false);
+ window.addEventListener("batterystatus", onBatteryStatus, false);
}
// Handle the batterystatus event
//
function onBatteryStatus(info) {
- console.log("Level: " + info.level + " isPlugged: " + info.isPlugged);
+ console.log("Level: " + info.level + " isPlugged: " + info.isPlugged);
}
-
+
</script>
</head>
<body onload="onLoad()">
http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/f98807e7/docs/en/edge/cordova/events/events.deviceready.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/events/events.deviceready.md b/docs/en/edge/cordova/events/events.deviceready.md
index 663f598..6440d95 100644
--- a/docs/en/edge/cordova/events/events.deviceready.md
+++ b/docs/en/edge/cordova/events/events.deviceready.md
@@ -27,7 +27,8 @@ The event fires when Cordova is fully loaded.
Details
-------
-This is a very important event that every Cordova application should use.
+This event is essential to any application. It signals that Cordova's
+device APIs have loaded and are ready to access.
Cordova consists of two code bases: native and JavaScript. While the
native code loads, a custom loading image displays. However,
@@ -35,10 +36,10 @@ JavaScript only loads once the DOM loads. This means your web
application may potentially call a Cordova JavaScript function before
the corresponding native code is available.
-The Cordova `deviceready` event fires once Cordova has fully loaded.
-After the device has fired, you can safely make calls to Cordova APIs.
-Applications typically attach an event listener with
-`document.addEventListener` once the HTML document's DOM has loaded.
+The `deviceready` event fires once Cordova has fully loaded. Once the
+event fires, you can safely make calls to Cordova APIs. Applications
+typically attach an event listener with `document.addEventListener`
+once the HTML document's DOM has loaded.
The `deviceready` event behaves somewhat differently from others. Any
event handler registered after the `deviceready` event fires has its
@@ -61,7 +62,7 @@ Quick Example
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
- // Now safe to use the Cordova API
+ // Now safe to use device APIs
}
Full Example
@@ -70,25 +71,21 @@ Full Example
<!DOCTYPE html>
<html>
<head>
- <title>Cordova Device Ready Example</title>
+ <title>Device Ready Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-x.x.x.js"></script>
<script type="text/javascript" charset="utf-8">
- // Call onDeviceReady when Cordova is loaded.
- //
- // At this point, the document has loaded but cordova-x.x.x.js has not.
- // When Cordova is loaded and talking with the native device,
- // it will call the event `deviceready`.
+ // Wait for device API libraries to load
//
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
- // Cordova is loaded and it is now safe to make calls Cordova methods
+ // device APIs are available
//
function onDeviceReady() {
- // Now safe to use the Cordova API
+ // Now safe to use device APIs
}
</script>