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 2012/05/08 23:31:40 UTC
docs commit: CB-589 Document confirmCallback for
navigator.notification.confirm
Updated Branches:
refs/heads/master 175748fdf -> 1f3131582
CB-589 Document confirmCallback for navigator.notification.confirm
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/1f313158
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/1f313158
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/1f313158
Branch: refs/heads/master
Commit: 1f3131582cd6a12e794725d73ff249b97a98ce78
Parents: 175748f
Author: Michael Brooks <mi...@michaelbrooks.ca>
Authored: Tue May 8 14:31:16 2012 -0700
Committer: Michael Brooks <mi...@michaelbrooks.ca>
Committed: Tue May 8 14:31:31 2012 -0700
----------------------------------------------------------------------
.../cordova/notification/notification.confirm.md | 32 ++++++++++-----
1 files changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/1f313158/docs/en/edge/cordova/notification/notification.confirm.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/notification/notification.confirm.md b/docs/en/edge/cordova/notification/notification.confirm.md
index b17a9ad..31fe0f3 100755
--- a/docs/en/edge/cordova/notification/notification.confirm.md
+++ b/docs/en/edge/cordova/notification/notification.confirm.md
@@ -25,7 +25,7 @@ Shows a customizable confirmation dialog box.
navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])
- __message:__ Dialog message (`String`)
-- __confirmCallback:__ - Callback to invoke with index of button pressed (1, 2 or 3). (`Number`)
+- __confirmCallback:__ - Callback to invoke with index of button pressed (1, 2 or 3). (`Function`)
- __title:__ Dialog title (`String`) (Optional, Default: "Confirm")
- __buttonLabels:__ Comma separated string with button labels (`String`) (Optional, Default: "OK,Cancel")
@@ -34,6 +34,13 @@ Description
Function `notification.confirm` displays a native dialog box that is more customizable than the browser's `confirm` function.
+confirmCallback
+---------------
+
+The `confirmCallback` is called when the user has pressed one of the buttons on the confirmation dialog box.
+
+The callback takes the argument `buttonIndex` (`Number`), which is the index of the pressed button. It's important to note that the index uses one-based indexing, so the value will be `1`, `2`, `3`, etc.
+
Supported Platforms
-------------------
@@ -47,8 +54,8 @@ Quick Example
-------------
// process the confirmation dialog result
- function onConfirm(button) {
- alert('You selected button ' + button);
+ function onConfirm(buttonIndex) {
+ alert('You selected button ' + buttonIndex);
}
// Show a custom confirmation dialog
@@ -84,8 +91,8 @@ Full Example
}
// process the confirmation dialog result
- function onConfirm(button) {
- alert('You selected button ' + button);
+ function onConfirm(buttonIndex) {
+ alert('You selected button ' + buttonIndex);
}
// Show a custom confirmation dialog
@@ -107,16 +114,19 @@ Full Example
</html>
Windows Phone 7 Quirks
--------------
+----------------------
-- Ignores button names, always 'OK|Cancel'
-- There is no built in browser confirm, so if you want to just write alert('foo'); you can assign window.confirm = navigator.notification.confirm;
-- alert + confirm calls are non-blocking, and result is only available asyncronously.
+- Ignores button names, always `'OK|Cancel'`.
+- There is no built-in browser function for `window.confirm`
+ - You can bind `window.confirm` by assigning `window.confirm = navigator.notification.confirm;`.
+- Calls to `alert` and `confirm` are non-blocking and result is only available asyncronously.
Bada 2.x Quirks
---------------
-- confirm uses javascript alert
+
+- `confirm` uses the browser's built-in `alert` function.
Bada 1.2 Quirks
---------------
-- Ignore button names, always 'OK|Cancel'
+
+- Ignore button names, always `'OK|Cancel'`.