1 | ;
|
2 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
3 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
4 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
5 | else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
6 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
7 | };
|
8 | var plugin_1 = require('./plugin');
|
9 | /**
|
10 | * @name Dialogs
|
11 | * @description
|
12 | * This plugin gives you ability to access and customize the device native dialogs.
|
13 | *
|
14 | * Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
|
15 | *
|
16 | * @usage
|
17 | * ```typescript
|
18 | * import { Dialogs } from 'ionic-native';
|
19 | *
|
20 | *
|
21 | *
|
22 | *
|
23 | * ```
|
24 | * @interfaces
|
25 | * DialogsPromptCallback
|
26 | */
|
27 | var Dialogs = (function () {
|
28 | function Dialogs() {
|
29 | }
|
30 | /**
|
31 | * Shows a custom alert or dialog box.
|
32 | * @param {string} message Dialog message.
|
33 | * @param {string} title Dialog title. (Optional, defaults to Alert)
|
34 | * @param {string} buttonName Button name. (Optional, defaults to OK)
|
35 | * @returns {Promise<any>} Returns a blank promise once the user has dismissed the alert.
|
36 | */
|
37 | Dialogs.alert = function (message, title, buttonName) {
|
38 | if (title === void 0) { title = 'Alert'; }
|
39 | if (buttonName === void 0) { buttonName = 'OK'; }
|
40 | return;
|
41 | };
|
42 | /**
|
43 | * Displays a customizable confirmation dialog box.
|
44 | * @param {string} message Dialog message.
|
45 | * @param {string} title Dialog title. (Optional, defaults to Confirm)
|
46 | * @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
|
47 | * @returns {Promise<number>} Returns a promise that resolves the button index that was clicked. Note that the index use one-based indexing.
|
48 | */
|
49 | Dialogs.confirm = function (message, title, buttonLabels) {
|
50 | if (title === void 0) { title = 'Confirm'; }
|
51 | if (buttonLabels === void 0) { buttonLabels = ['OK', 'Cancel']; }
|
52 | return;
|
53 | };
|
54 | /**
|
55 | * Displays a native dialog box that is more customizable than the browser's prompt function.
|
56 | * @param {string} message Dialog message.
|
57 | * @param {string} title Dialog title. (Optional, defaults to Prompt)
|
58 | * @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"])
|
59 | * @param {string} defaultText Default textbox input value. (Optional, Default: empty string)
|
60 | * @returns {Promise<DialogsPromptCallback>} Returns a promise that resolves an object with the button index clicked and the text entered
|
61 | */
|
62 | Dialogs.prompt = function (message, title, buttonLabels, defaultText) {
|
63 | if (title === void 0) { title = 'Prompt'; }
|
64 | if (buttonLabels === void 0) { buttonLabels = ['OK', 'Cancel']; }
|
65 | if (defaultText === void 0) { defaultText = ''; }
|
66 | return;
|
67 | };
|
68 | /**
|
69 | * The device plays a beep sound.
|
70 | * @param {numbers} times The number of times to repeat the beep.
|
71 | */
|
72 | Dialogs.beep = function (times) { };
|
73 | __decorate([
|
74 | plugin_1.Cordova({
|
75 | successIndex: 1,
|
76 | errorIndex: 4
|
77 | })
|
78 | ], Dialogs, "alert", null);
|
79 | __decorate([
|
80 | plugin_1.Cordova({
|
81 | successIndex: 1,
|
82 | errorIndex: 4
|
83 | })
|
84 | ], Dialogs, "confirm", null);
|
85 | __decorate([
|
86 | plugin_1.Cordova({
|
87 | successIndex: 1,
|
88 | errorIndex: 5
|
89 | })
|
90 | ], Dialogs, "prompt", null);
|
91 | __decorate([
|
92 | plugin_1.Cordova({
|
93 | sync: true
|
94 | })
|
95 | ], Dialogs, "beep", null);
|
96 | Dialogs = __decorate([
|
97 | plugin_1.Plugin({
|
98 | pluginName: 'Dialogs',
|
99 | plugin: 'cordova-plugin-dialogs',
|
100 | pluginRef: 'navigator.notification',
|
101 | repo: 'https://github.com/apache/cordova-plugin-dialogs.git'
|
102 | })
|
103 | ], Dialogs);
|
104 | return Dialogs;
|
105 | }());
|
106 | exports.Dialogs = Dialogs;
|
107 | //# sourceMappingURL=dialogs.js.map |
\ | No newline at end of file |