Skip to content

Commit 4ae0251

Browse files
slerouxejzn
authored andcommitted
Added documentation for the toast API
1 parent 00ca8d2 commit 4ae0251

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

api/blackberry_ui_toast.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright 2010-2012 Research In Motion Limited.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* @toc {User Interface} Toast
19+
* @featureID blackberry.ui.toast
20+
* @namespace The Toast object contains functions for displaying toast notifications.
21+
* <p/>
22+
* The functionality of this object allows the developer to display system toast notifications within their WebWorks application.
23+
*/
24+
blackberry.ui.toast ={
25+
26+
/**
27+
* @param {String} message Message to be displayed in the toast.
28+
* @param {Object} [options] An optional options object that specifies the buttonText, and callback handlers that should be used by the toast
29+
* @param {String} [options.buttonText] Optional parameter that specifies the label for the button within the toast.
30+
* @callback {function} [options.buttonCallback] Optional callback for receiving the button event when the user selects the toast button.
31+
* @callback {function} [options.dismissCallback] Optional callback for receiving an event when the toast dismisses either through the toast's timeout or when the button is selected.
32+
* @returns {Number} A numeric ID to reference this toast by.
33+
* @description Displays a toast notification.
34+
* @BB10X
35+
* @example
36+
* &lt;script type="text/javascript"&gt;
37+
*
38+
* function showCustomToast() {
39+
* var message = "This is my toast!",
40+
* buttonText = "Click Me",
41+
* toastId,
42+
* onButtonSelected = function () {
43+
* console.log('Button was clicked for toast: ' + toastId);
44+
* },
45+
* onToastDismissed = function () {
46+
* console.log('Toast disappeared: ' + toastId);
47+
* },
48+
* options = {
49+
* buttonText : buttonText,
50+
* dissmissCallback : onToastDismissed,
51+
* buttonCallback : onButtonSelected
52+
* };
53+
*
54+
* toastId = blackberry.ui.toast.show(message, options);
55+
* }
56+
*
57+
* &lt;/script&gt;
58+
*/
59+
show : function(message, options){};
60+
};

0 commit comments

Comments
 (0)