ionic-native
Version:
Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support
105 lines • 4.31 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Cordova, Plugin } from './plugin';
/**
* @name Dialogs
* @description
* This plugin gives you ability to access and customize the device native dialogs.
*
* Requires Cordova plugin: `cordova-plugin-dialogs`. For more info, please see the [Dialogs plugin docs](https://github.com/apache/cordova-plugin-dialogs).
*
* @usage
* ```typescript
* import { Dialogs } from 'ionic-native';
*
*
*
*
* ```
* @interfaces
* DialogsPromptCallback
*/
export var Dialogs = (function () {
function Dialogs() {
}
/**
* Shows a custom alert or dialog box.
* @param {string} message Dialog message.
* @param {string} title Dialog title. (Optional, defaults to Alert)
* @param {string} buttonName Button name. (Optional, defaults to OK)
* @returns {Promise<any>} Returns a blank promise once the user has dismissed the alert.
*/
Dialogs.alert = function (message, title, buttonName) {
if (title === void 0) { title = 'Alert'; }
if (buttonName === void 0) { buttonName = 'OK'; }
return;
};
/**
* Displays a customizable confirmation dialog box.
* @param {string} message Dialog message.
* @param {string} title Dialog title. (Optional, defaults to Confirm)
* @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to [OK,Cancel])
* @returns {Promise<number>} Returns a promise that resolves the button index that was clicked. Note that the index use one-based indexing.
*/
Dialogs.confirm = function (message, title, buttonLabels) {
if (title === void 0) { title = 'Confirm'; }
if (buttonLabels === void 0) { buttonLabels = ['OK', 'Cancel']; }
return;
};
/**
* Displays a native dialog box that is more customizable than the browser's prompt function.
* @param {string} message Dialog message.
* @param {string} title Dialog title. (Optional, defaults to Prompt)
* @param {Array<string>} buttonLabels Array of strings specifying button labels. (Optional, defaults to ["OK","Cancel"])
* @param {string} defaultText Default textbox input value. (Optional, Default: empty string)
* @returns {Promise<DialogsPromptCallback>} Returns a promise that resolves an object with the button index clicked and the text entered
*/
Dialogs.prompt = function (message, title, buttonLabels, defaultText) {
if (title === void 0) { title = 'Prompt'; }
if (buttonLabels === void 0) { buttonLabels = ['OK', 'Cancel']; }
if (defaultText === void 0) { defaultText = ''; }
return;
};
/**
* The device plays a beep sound.
* @param {numbers} times The number of times to repeat the beep.
*/
Dialogs.beep = function (times) { };
__decorate([
Cordova({
successIndex: 1,
errorIndex: 4
})
], Dialogs, "alert", null);
__decorate([
Cordova({
successIndex: 1,
errorIndex: 4
})
], Dialogs, "confirm", null);
__decorate([
Cordova({
successIndex: 1,
errorIndex: 5
})
], Dialogs, "prompt", null);
__decorate([
Cordova({
sync: true
})
], Dialogs, "beep", null);
Dialogs = __decorate([
Plugin({
pluginName: 'Dialogs',
plugin: 'cordova-plugin-dialogs',
pluginRef: 'navigator.notification',
repo: 'https://github.com/apache/cordova-plugin-dialogs.git'
})
], Dialogs);
return Dialogs;
}());
//# sourceMappingURL=dialogs.js.map