You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2017/01/20 08:41:27 UTC

cordova-plugin-dialogs git commit: CB-12369: Add plugin typings from DefinitelyTyped

Repository: cordova-plugin-dialogs
Updated Branches:
  refs/heads/master e5b7cb83f -> ac4b0e064


CB-12369: Add plugin typings from DefinitelyTyped

 This closes #91


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/commit/ac4b0e06
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/tree/ac4b0e06
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/diff/ac4b0e06

Branch: refs/heads/master
Commit: ac4b0e064cde49470fc61a09a85cbf5f91ae2388
Parents: e5b7cb8
Author: Nikita Matrosov <v-...@microsoft.com>
Authored: Thu Jan 19 16:06:51 2017 +0300
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Fri Jan 20 11:41:11 2017 +0300

----------------------------------------------------------------------
 package.json     |  1 +
 types/index.d.ts | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/ac4b0e06/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 73825a8..bbf3a3f 100644
--- a/package.json
+++ b/package.json
@@ -2,6 +2,7 @@
   "name": "cordova-plugin-dialogs",
   "version": "1.3.2-dev",
   "description": "Cordova Notification Plugin",
+  "types": "./types/index.d.ts",
   "cordova": {
     "id": "cordova-plugin-dialogs",
     "platforms": [

http://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs/blob/ac4b0e06/types/index.d.ts
----------------------------------------------------------------------
diff --git a/types/index.d.ts b/types/index.d.ts
new file mode 100644
index 0000000..8a4035b
--- /dev/null
+++ b/types/index.d.ts
@@ -0,0 +1,69 @@
+// Type definitions for Apache Cordova Dialogs plugin
+// Project: https://github.com/apache/cordova-plugin-dialogs
+// Definitions by: Microsoft Open Technologies Inc <http://msopentech.com>
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// 
+// Copyright (c) Microsoft Open Technologies Inc
+// Licensed under the MIT license. 
+
+interface Navigator {
+    /** This plugin provides access to some native dialog UI elements. */
+    notification: Notification
+}
+
+/** This plugin provides access to some native dialog UI elements. */
+interface Notification {
+    /**
+     * Shows a custom alert or dialog box. Most Cordova implementations use a native dialog box for this feature,
+     * but some platforms use the browser's alert function, which is typically less customizable.
+     * @param message       Dialog message.
+     * @param alertCallback Callback to invoke when alert dialog is dismissed.
+     * @param title         Dialog title, defaults to 'Alert'.
+     * @param buttonName    Button name, defaults to OK.
+     */
+    alert(message: string,
+        alertCallback: () => void,
+        title?: string,
+        buttonName?: string): void;
+    /**
+     * The device plays a beep sound.
+     * @param times The number of times to repeat the beep. 
+     */
+    beep(times: number): void;
+    /**
+     * Displays a customizable confirmation dialog box.
+     * @param message           Dialog message.
+     * @param confirmCallback   Callback to invoke with index of button pressed (1, 2, or 3)
+     *                                   or when the dialog is dismissed without a button press (0).
+     * @param title             Dialog title, defaults to Confirm.
+     * @param buttonLabels      Array of strings specifying button labels, defaults to [OK,Cancel].
+     */
+    confirm(message: string,
+        confirmCallback: (choice: number) => void,
+        title?: string,
+        buttonLabels?: string[]): void;
+    /**
+     * Displays a native dialog box that is more customizable than the browser's prompt function.
+     * @param message           Dialog message.
+     * @param promptCallback    Callback to invoke when a button is pressed.
+     * @param title             Dialog title, defaults to "Prompt".
+     * @param buttonLabels      Array of strings specifying button labels, defaults to ["OK","Cancel"].
+     * @param defaultText       Default textbox input value, default: "".
+     */
+    prompt(message: string,
+        promptCallback: (result: NotificationPromptResult) => void,
+        title?: string,
+        buttonLabels?: string[],
+        defaultText?: string): void;
+}
+
+/** Object, passed to promptCallback */
+interface NotificationPromptResult {
+    /**
+     * The index of the pressed button. Note that the index uses one-based indexing, so the value is 1, 2, 3, etc.
+     * 0 is the result when the dialog is dismissed without a button press.
+     */
+    buttonIndex: number;
+    /** The text entered in the prompt dialog box. */
+    input1: string;
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org