{"id":14987847,"url":"https://github.com/apache/cordova-plugin-dialogs","last_synced_at":"2025-10-17T13:48:33.137Z","repository":{"id":9085299,"uuid":"10860597","full_name":"apache/cordova-plugin-dialogs","owner":"apache","description":"Apache Cordova Dialogs Plugin","archived":false,"fork":false,"pushed_at":"2024-10-26T03:38:29.000Z","size":620,"stargazers_count":289,"open_issues_count":25,"forks_count":354,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-04-03T04:16:52.584Z","etag":null,"topics":["android","cordova","hacktoberfest","ios","java","javascript","library","mobile","nodejs","objective-c"],"latest_commit_sha":null,"homepage":"https://cordova.apache.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-22T07:00:15.000Z","updated_at":"2024-10-28T20:25:01.000Z","dependencies_parsed_at":"2024-11-19T17:50:03.251Z","dependency_job_id":"18930cd1-910f-4881-be16-46b6b9a57d4f","html_url":"https://github.com/apache/cordova-plugin-dialogs","commit_stats":{"total_commits":283,"total_committers":80,"mean_commits":3.5375,"dds":0.8021201413427562,"last_synced_commit":"e25faaf1fc1a0020b121c513acd039205b5eb8b9"},"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-dialogs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-dialogs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-dialogs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fcordova-plugin-dialogs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/cordova-plugin-dialogs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247910598,"owners_count":21016714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","cordova","hacktoberfest","ios","java","javascript","library","mobile","nodejs","objective-c"],"created_at":"2024-09-24T14:15:33.991Z","updated_at":"2025-10-17T13:48:33.129Z","avatar_url":"https://github.com/apache.png","language":"JavaScript","readme":"---\ntitle: Dialogs\ndescription: Use native dialog UI elements\n---\n\u003c!--\n# license: Licensed to the Apache Software Foundation (ASF) under one\n#         or more contributor license agreements.  See the NOTICE file\n#         distributed with this work for additional information\n#         regarding copyright ownership.  The ASF licenses this file\n#         to you under the Apache License, Version 2.0 (the\n#         \"License\"); you may not use this file except in compliance\n#         with the License.  You may obtain a copy of the License at\n#\n#           http://www.apache.org/licenses/LICENSE-2.0\n#\n#         Unless required by applicable law or agreed to in writing,\n#         software distributed under the License is distributed on an\n#         \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#         KIND, either express or implied.  See the License for the\n#         specific language governing permissions and limitations\n#         under the License.\n--\u003e\n\n# cordova-plugin-dialogs\n\n[![Android Testsuite](https://github.com/apache/cordova-plugin-dialogs/actions/workflows/android.yml/badge.svg)](https://github.com/apache/cordova-plugin-dialogs/actions/workflows/android.yml) [![Chrome Testsuite](https://github.com/apache/cordova-plugin-dialogs/actions/workflows/chrome.yml/badge.svg)](https://github.com/apache/cordova-plugin-dialogs/actions/workflows/chrome.yml) [![iOS Testsuite](https://github.com/apache/cordova-plugin-dialogs/actions/workflows/ios.yml/badge.svg)](https://github.com/apache/cordova-plugin-dialogs/actions/workflows/ios.yml) [![Lint Test](https://github.com/apache/cordova-plugin-dialogs/actions/workflows/lint.yml/badge.svg)](https://github.com/apache/cordova-plugin-dialogs/actions/workflows/lint.yml)\n\nThis plugin provides access to some native dialog UI elements\nvia a global `navigator.notification` object.\n\nAlthough the object is attached to the global scoped `navigator`, it is not available until after the `deviceready` event.\n\n    document.addEventListener(\"deviceready\", onDeviceReady, false);\n    function onDeviceReady() {\n        console.log(navigator.notification);\n    }\n\n## Installation\n\n    cordova plugin add cordova-plugin-dialogs\n\n## Methods\n\n- `navigator.notification.alert`\n- `navigator.notification.confirm`\n- `navigator.notification.prompt`\n- `navigator.notification.beep`\n- `navigator.notification.dismissPrevious`\n- `navigator.notification.dismissAll`\n\n## navigator.notification.alert\n\nShows a custom alert or dialog box.  Most Cordova implementations use a native\ndialog box for this feature, but some platforms use the browser's `alert`\nfunction, which is typically less customizable.\n\n    navigator.notification.alert(message, alertCallback, [title], [buttonName])\n\n- __message__: Dialog message. _(String)_\n\n- __alertCallback__: Callback to invoke when alert dialog is dismissed. _(Function)_\n\n- __title__: Dialog title. _(String)_ (Optional, defaults to `Alert`)\n\n- __buttonName__: Button name. _(String)_ (Optional, defaults to `OK`)\n\n\n### Example\n\n    function alertDismissed() {\n        // do something\n    }\n\n    navigator.notification.alert(\n        'You are the winner!',  // message\n        alertDismissed,         // callback\n        'Game Over',            // title\n        'Done'                  // buttonName\n    );\n\n### Supported Platforms\n\n- Android\n- Browser\n- iOS\n\n## navigator.notification.confirm\n\nDisplays a customizable confirmation dialog box.\n\n    navigator.notification.confirm(message, confirmCallback, [title], [buttonLabels])\n\n- __message__: Dialog message. _(String)_\n\n- __confirmCallback__: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). _(Function)_\n\n- __title__: Dialog title. _(String)_ (Optional, defaults to `Confirm`)\n\n- __buttonLabels__: Array of strings specifying button labels. _(Array)_  (Optional, defaults to [`OK,Cancel`])\n\n\n### confirmCallback\n\nThe `confirmCallback` executes when the user presses one of the\nbuttons in the confirmation dialog box.\n\nThe callback takes the argument `buttonIndex` _(Number)_, which is the\nindex of the pressed button. Note that the index uses one-based\nindexing, so the value is `1`, `2`, `3`, etc.\n\n### Example\n\n    function onConfirm(buttonIndex) {\n        alert('You selected button ' + buttonIndex);\n    }\n\n    navigator.notification.confirm(\n        'You are the winner!', // message\n         onConfirm,            // callback to invoke with index of button pressed\n        'Game Over',           // title\n        ['Restart','Exit']     // buttonLabels\n    );\n\n### Supported Platforms\n\n- Android\n- Browser\n- iOS\n\n### Android Quirks\n\n- Android supports a maximum of three buttons, and ignores any more than that.\n\n- Android dialog title cannot exceed 2 lines of content, it will ignore any more than this.\n\n## navigator.notification.prompt\n\nDisplays a native dialog box that is more customizable than the browser's `prompt` function.\n\n    navigator.notification.prompt(message, promptCallback, [title], [buttonLabels], [defaultText])\n\n- __message__: Dialog message. _(String)_\n\n- __promptCallback__: Callback to invoke with index of button pressed (1, 2, or 3) or when the dialog is dismissed without a button press (0). _(Function)_\n\n- __title__: Dialog title _(String)_ (Optional, defaults to `Prompt`)\n\n- __buttonLabels__: Array of strings specifying button labels _(Array)_ (Optional, defaults to `[\"OK\",\"Cancel\"]`)\n\n- __defaultText__: Default textbox input value (`String`) (Optional, Default: empty string)\n\n### promptCallback\n\nThe `promptCallback` executes when the user presses one of the buttons\nin the prompt dialog box. The `results` object passed to the callback\ncontains the following properties:\n\n- __buttonIndex__: The index of the pressed button. _(Number)_ Note that the index uses one-based indexing, so the value is `1`, `2`, `3`, etc.\n\n\n\n- __input1__: The text entered in the prompt dialog box. _(String)_\n\n### Example\n\n    function onPrompt(results) {\n        alert(\"You selected button number \" + results.buttonIndex + \" and entered \" + results.input1);\n    }\n\n    navigator.notification.prompt(\n        'Please enter your name',  // message\n        onPrompt,                  // callback to invoke\n        'Registration',            // title\n        ['Ok','Exit'],             // buttonLabels\n        'Jane Doe'                 // defaultText\n    );\n\n### Supported Platforms\n\n- Android\n- Browser\n- iOS\n\n### Android Quirks\n\n- Android supports a maximum of three buttons, and ignores any more than that.\n\n- On Android 3.0 and later, buttons are displayed in reverse order for devices that use the Holo theme.\n\n## navigator.notification.beep\n\nThe device plays a beep sound.\n\n    navigator.notification.beep(times);\n\n- __times__: The number of times to repeat the beep. _(Number)_\n\n### Example\n\n    // Beep twice!\n    navigator.notification.beep(2);\n\n### Supported Platforms\n\n- Android\n- Browser\n- iOS\n\n### Android Quirks\n\n- Android plays the default __Notification ringtone__ specified under the __Settings/Sound \u0026 Display__ panel.\n\n## navigator.notification.dismissPrevious\n\nDismisses the previously opened dialog box.\nIf no dialog box is currently open, the `errorCallback` will be called.\n\n    navigator.notification.dismissPrevious([successCallback], [errorCallback])\n\n- __successCallback__: Callback to invoke when previously opened dialog has been dismissed. _(Function)_ (Optional)\n- __errorCallback__: Callback to invoke on failure to dismiss previously opened dialog. Will be passed the error message. _(Function)_ (Optional)\n\n### Example\n\n    function successCallback() {\n        console.log(\"Successfully dismissed previously opened dialog.\");\n    }\n    \n    function errorCallback(error) {\n        console.log(\"Failed to dismiss previously opened dialog: \" + error);\n    }\n\n    navigator.notification.dismissPrevious(\n        successCallback,\n        errorCallback\n    );\n\n### Supported Platforms\n\n- Android\n- iOS\n\n## navigator.notification.dismissAll\n\nDismisses all previously opened dialog boxes.\nIf no dialog box is currently open, the `errorCallback` will be called.\n\n    navigator.notification.dismissAll([successCallback], [errorCallback])\n\n- __successCallback__: Callback to invoke when all previously opened dialogs have been dismissed. _(Function)_ (Optional)\n- __errorCallback__: Callback to invoke on failure to dismiss all previously opened dialogs. Will be passed the error message. _(Function)_ (Optional)\n\n### Example\n\n    function successCallback() {\n        console.log(\"Successfully dismissed all previously opened dialogs.\");\n    }\n    \n    function errorCallback(error) {\n        console.log(\"Failed to dismiss all previously opened dialogs: \" + error);\n    }\n\n    navigator.notification.dismissAll(\n        successCallback,\n        errorCallback\n    );\n\n### Supported Platforms\n\n- Android\n- iOS\n","funding_links":[],"categories":["Index"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fcordova-plugin-dialogs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fcordova-plugin-dialogs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fcordova-plugin-dialogs/lists"}