You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2020/07/02 10:12:46 UTC

[cordova-plugin-dialogs] branch master updated: refactor(eslint): use cordova-eslint /w fix (#141)

This is an automated email from the ASF dual-hosted git repository.

timbru31 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-dialogs.git


The following commit(s) were added to refs/heads/master by this push:
     new 26e6764  refactor(eslint): use cordova-eslint /w fix (#141)
26e6764 is described below

commit 26e676417a0ab1a1641215d95a9415be4ef04328
Author: Tim Brust <gi...@timbrust.de>
AuthorDate: Thu Jul 2 10:12:28 2020 +0000

    refactor(eslint): use cordova-eslint /w fix (#141)
---
 .eslintrc.yml                    |  31 ++++--
 package.json                     |  12 +--
 src/windows/NotificationProxy.js |  28 +++--
 tests/tests.js                   | 222 ++++++++++++++++++++++++++-------------
 www/android/notification.js      |   8 +-
 www/browser/notification.js      |  14 +--
 www/notification.js              |  48 +++++----
 7 files changed, 225 insertions(+), 138 deletions(-)

diff --git a/.eslintrc.yml b/.eslintrc.yml
index 0cccb8c..17277f7 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -1,10 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
 root: true
-extends: semistandard
-rules:
-  indent:
-    - error
-    - 4
-  camelcase: off
-  padded-blocks: off
-  operator-linebreak: off
-  no-throw-literal: off
\ No newline at end of file
+extends: '@cordova/eslint-config/browser'
+
+overrides:
+    - files: [tests/**/*.js]
+      extends: '@cordova/eslint-config/node-tests'
diff --git a/package.json b/package.json
index c0f9fc8..afe414e 100644
--- a/package.json
+++ b/package.json
@@ -24,8 +24,8 @@
     "cordova-windows"
   ],
   "scripts": {
-    "test": "npm run eslint",
-    "eslint": "node node_modules/eslint/bin/eslint www && node node_modules/eslint/bin/eslint src && node node_modules/eslint/bin/eslint tests"
+    "test": "npm run lint",
+    "lint": "eslint ."
   },
   "author": "Apache Software Foundation",
   "license": "Apache-2.0",
@@ -37,12 +37,6 @@
     }
   },
   "devDependencies": {
-    "eslint": "^3.19.0",
-    "eslint-config-semistandard": "^11.0.0",
-    "eslint-config-standard": "^10.2.1",
-    "eslint-plugin-import": "^2.3.0",
-    "eslint-plugin-node": "^5.0.0",
-    "eslint-plugin-promise": "^3.5.0",
-    "eslint-plugin-standard": "^3.0.1"
+    "@cordova/eslint-config": "^3.0.0"
   }
 }
diff --git a/src/windows/NotificationProxy.js b/src/windows/NotificationProxy.js
index c3f9fc1..1ccc18e 100644
--- a/src/windows/NotificationProxy.js
+++ b/src/windows/NotificationProxy.js
@@ -19,7 +19,7 @@
  *
  */
 
-/* global Windows:true, WinJS, toStaticHTML */
+/* global Windows, WinJS, toStaticHTML */
 
 var cordova = require('cordova');
 var urlutil = require('cordova/urlutil');
@@ -46,7 +46,9 @@ function createCSSElem (fileName) {
 }
 
 // CB-8928: When toStaticHTML is undefined, prompt fails to run
-var _cleanHtml = function (html) { return html; };
+var _cleanHtml = function (html) {
+    return html;
+};
 if (typeof toStaticHTML !== 'undefined') {
     _cleanHtml = toStaticHTML;
 }
@@ -54,7 +56,6 @@ if (typeof toStaticHTML !== 'undefined') {
 // Windows does not provide native UI for promp dialog so we use some
 // simple html-based implementation until it is available
 function createPromptDialog (title, message, buttons, defaultText, callback) {
-
     var isPhone = cordova.platformId === 'windows' && WinJS.Utilities.isPhone;
     var isWindows = !!cordova.platformId.match(/windows/);
 
@@ -73,9 +74,11 @@ function createPromptDialog (title, message, buttons, defaultText, callback) {
     }
 
     // dialog layout template
-    dlg.innerHTML = _cleanHtml("<span id='lbl-title'></span><br/>" + // title
+    dlg.innerHTML = _cleanHtml(
+        "<span id='lbl-title'></span><br/>" + // title
         "<span id='lbl-message'></span><br/>" + // message
-        "<input id='prompt-input'/><br/>"); // input fields
+            "<input id='prompt-input'/><br/>"
+    ); // input fields
 
     dlg.querySelector('#lbl-title').appendChild(document.createTextNode(title));
     dlg.querySelector('#lbl-message').appendChild(document.createTextNode(message));
@@ -88,7 +91,8 @@ function createPromptDialog (title, message, buttons, defaultText, callback) {
             dlgWrap.parentNode.removeChild(dlgWrap);
 
             if (callback) {
-                callback({ input1: value, buttonIndex: idx }); // eslint-disable-line standard/no-callback-literal
+                // eslint-disable-next-line standard/no-callback-literal
+                callback({ input1: value, buttonIndex: idx });
             }
         };
     }
@@ -118,7 +122,8 @@ function createPromptDialog (title, message, buttons, defaultText, callback) {
     // add Enter/Return key handling
     var defaultButton = dlg.querySelector('.dlgButtonFirst');
     dlg.addEventListener('keypress', function (e) {
-        if (e.keyCode === 13) { // enter key
+        if (e.keyCode === 13) {
+            // enter key
             if (defaultButton) {
                 defaultButton.click();
             }
@@ -130,7 +135,6 @@ function createPromptDialog (title, message, buttons, defaultText, callback) {
 
 module.exports = {
     alert: function (win, loseX, args) {
-
         if (isAlertShowing) {
             var later = function () {
                 module.exports.alert(win, loseX, args);
@@ -155,7 +159,6 @@ module.exports = {
             if (alertStack.length) {
                 setTimeout(alertStack.shift(), 0);
             }
-
         });
     },
 
@@ -182,7 +185,6 @@ module.exports = {
                     win(evt);
                 }
             });
-
         } catch (e) {
             // set isAlertShowing flag back to false in case of exception
             isAlertShowing = false;
@@ -195,7 +197,6 @@ module.exports = {
     },
 
     confirm: function (win, loseX, args) {
-
         if (isAlertShowing) {
             var later = function () {
                 module.exports.confirm(win, loseX, args);
@@ -226,7 +227,6 @@ module.exports = {
                 if (alertStack.length) {
                     setTimeout(alertStack.shift(), 0);
                 }
-
             });
         } catch (e) {
             // set isAlertShowing flag back to false in case of exception
@@ -240,11 +240,10 @@ module.exports = {
     },
 
     beep: function (winX, loseX, args) {
-
         // set a default args if it is not set
         args = args && args.length ? args : ['1'];
 
-        var snd = new Audio('ms-winsoundevent:Notification.Default'); // eslint-disable-line no-undef
+        var snd = new Audio('ms-winsoundevent:Notification.Default');
         var count = parseInt(args[0]) || 1;
         snd.msAudioCategory = 'Alerts';
 
@@ -262,7 +261,6 @@ module.exports = {
         };
         snd.addEventListener('ended', onEvent);
         onEvent();
-
     }
 };
 
diff --git a/tests/tests.js b/tests/tests.js
index 004570a..a6a67a4 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -17,9 +17,8 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
-/* eslint-env jasmine */
 /* global cordova */
 
 exports.defineAutoTests = function () {
@@ -74,33 +73,39 @@ exports.defineManualTests = function (contentEl, createActionButton) {
 
     var alertDialog = function (message, title, button) {
         console.log('alertDialog()');
-        navigator.notification.alert(message,
+        navigator.notification.alert(
+            message,
             function () {
                 console.log('Alert dismissed.');
             },
-            title, button);
+            title,
+            button
+        );
         console.log('After alert');
     };
 
     var confirmDialogA = function (message, title, buttons) {
         clearLog();
-        navigator.notification.confirm(message,
+        navigator.notification.confirm(
+            message,
             function (r) {
                 if (r === 0) {
                     logMessage('Dismissed dialog without making a selection.');
                     console.log('Dismissed dialog without making a selection.');
                 } else {
                     console.log('You selected ' + r);
-                    logMessage('You selected ' + (buttons.split(','))[r - 1]);
+                    logMessage('You selected ' + buttons.split(',')[r - 1]);
                 }
             },
             title,
-            buttons);
+            buttons
+        );
     };
 
     var confirmDialogB = function (message, title, buttons) {
         clearLog();
-        navigator.notification.confirm(message,
+        navigator.notification.confirm(
+            message,
             function (r) {
                 if (r === 0) {
                     logMessage('Dismissed dialog without making a selection.');
@@ -111,12 +116,14 @@ exports.defineManualTests = function (contentEl, createActionButton) {
                 }
             },
             title,
-            buttons);
+            buttons
+        );
     };
 
     var promptDialog = function (message, title, buttons, defaultText) {
         clearLog();
-        navigator.notification.prompt(message,
+        navigator.notification.prompt(
+            message,
             function (r) {
                 if (r && r.buttonIndex === 0) {
                     var msg = 'Dismissed dialog';
@@ -131,12 +138,15 @@ exports.defineManualTests = function (contentEl, createActionButton) {
                 }
             },
             title,
-            buttons, defaultText);
+            buttons,
+            defaultText
+        );
     };
 
     /******************************************************************************/
 
-    var dialogs_tests = '<div id="beep"></div>' +
+    var dialogs_tests =
+        '<div id="beep"></div>' +
         'Expected result: Device will beep (unless device is on silent). Nothing will get updated in status box.' +
         '<h2>Dialog Tests</h2>' +
         '<h3>Dialog boxes will pop up for each of the following tests</h3>' +
@@ -157,81 +167,143 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         '<p/> <h3>CB-8947 Tests</h3><div id="cb8947"></div>' +
         'Expected results: Dialogs will not crash iOS';
 
-    contentEl.innerHTML = '<div id="info"></div>' +
-        dialogs_tests;
+    contentEl.innerHTML = '<div id="info"></div>' + dialogs_tests;
 
-    createActionButton('Beep', function () {
-        beep();
-    }, 'beep');
+    createActionButton(
+        'Beep',
+        function () {
+            beep();
+        },
+        'beep'
+    );
 
-    createActionButton('Alert Dialog', function () {
-        alertDialog('You pressed alert.', 'Alert Dialog', 'Continue');
-    }, 'alert');
+    createActionButton(
+        'Alert Dialog',
+        function () {
+            alertDialog('You pressed alert.', 'Alert Dialog', 'Continue');
+        },
+        'alert'
+    );
 
     // WP8.1 detection is necessary since it doesn't support confirm dialogs with more than 2 buttons
     var isRunningOnWP81 = cordova.platformId === 'windows' && navigator.userAgent.indexOf('Windows Phone') > -1;
 
-    createActionButton('Confirm Dialog - Deprecated', function () {
-        var buttons = isRunningOnWP81 ? 'Yes,No' : 'Yes,No,Maybe';
-        confirmDialogA('You pressed confirm.', 'Confirm Dialog', buttons);
-    }, 'confirm_deprecated');
-
-    createActionButton('Confirm Dialog', function () {
-        var buttons = isRunningOnWP81 ? ['Yes', 'Actually, No'] : ['Yes', 'No', 'Maybe, Not Sure'];
-        confirmDialogB('You pressed confirm.', 'Confirm Dialog', buttons);
-    }, 'confirm');
-
-    createActionButton('Prompt Dialog', function () {
-        promptDialog('You pressed prompt.', 'Prompt Dialog', ['Yes', 'No', 'Maybe, Not Sure'], 'Default Text');
-    }, 'prompt');
-
-    createActionButton('Prompt Dialog - no default', function () {
-        promptDialog('You pressed prompt.', 'Prompt Dialog', ['Yes', 'No']);
-    }, 'prompt');
-
-    createActionButton('Built-in Alert Dialog', function () {
-        if (typeof alert === 'function') {
-            alert('You pressed alert'); // eslint-disable-line no-undef
-        }
-    }, 'built_in_alert');
-
-    createActionButton('Built-in Confirm Dialog', function () {
-        if (typeof confirm === 'function') {
-            confirm('You selected confirm'); // eslint-disable-line no-undef
-        }
-    }, 'built_in_confirm');
-
-    createActionButton('Built-in Prompt Dialog', function () {
-        if (typeof prompt === 'function') {
-            prompt('This is a prompt', 'Default value'); // eslint-disable-line no-undef
-        }
-    }, 'built_in_prompt');
+    createActionButton(
+        'Confirm Dialog - Deprecated',
+        function () {
+            var buttons = isRunningOnWP81 ? 'Yes,No' : 'Yes,No,Maybe';
+            confirmDialogA('You pressed confirm.', 'Confirm Dialog', buttons);
+        },
+        'confirm_deprecated'
+    );
+
+    createActionButton(
+        'Confirm Dialog',
+        function () {
+            var buttons = isRunningOnWP81 ? ['Yes', 'Actually, No'] : ['Yes', 'No', 'Maybe, Not Sure'];
+            confirmDialogB('You pressed confirm.', 'Confirm Dialog', buttons);
+        },
+        'confirm'
+    );
+
+    createActionButton(
+        'Prompt Dialog',
+        function () {
+            promptDialog('You pressed prompt.', 'Prompt Dialog', ['Yes', 'No', 'Maybe, Not Sure'], 'Default Text');
+        },
+        'prompt'
+    );
+
+    createActionButton(
+        'Prompt Dialog - no default',
+        function () {
+            promptDialog('You pressed prompt.', 'Prompt Dialog', ['Yes', 'No']);
+        },
+        'prompt'
+    );
+
+    createActionButton(
+        'Built-in Alert Dialog',
+        function () {
+            if (typeof alert === 'function') {
+                alert('You pressed alert');
+            }
+        },
+        'built_in_alert'
+    );
+
+    createActionButton(
+        'Built-in Confirm Dialog',
+        function () {
+            if (typeof confirm === 'function') {
+                confirm('You selected confirm');
+            }
+        },
+        'built_in_confirm'
+    );
+
+    createActionButton(
+        'Built-in Prompt Dialog',
+        function () {
+            if (typeof prompt === 'function') {
+                prompt('This is a prompt', 'Default value');
+            }
+        },
+        'built_in_prompt'
+    );
 
     // CB-8947 - ensure number messages don't crash iOS
-    createActionButton('Alert Dialog with Number', function () {
-        var callback = function () { clearLog(); console.log('Test passed'); };
-        navigator.notification.alert(17, callback);
-    }, 'cb8947');
+    createActionButton(
+        'Alert Dialog with Number',
+        function () {
+            var callback = function () {
+                clearLog();
+                console.log('Test passed');
+            };
+            navigator.notification.alert(17, callback);
+        },
+        'cb8947'
+    );
 
     // CB-8947 - ensure object messages don't crash iOS
-    createActionButton('Alert Dialog with Object', function () {
-        var object = { number: 42, message: "Make sure an object doesn't crash iOS", issue: 'CB-8947' };
-        var callback = function () { clearLog(); console.log('Test passed'); };
-        navigator.notification.alert(object, callback);
-    }, 'cb8947');
+    createActionButton(
+        'Alert Dialog with Object',
+        function () {
+            var object = { number: 42, message: "Make sure an object doesn't crash iOS", issue: 'CB-8947' };
+            var callback = function () {
+                clearLog();
+                console.log('Test passed');
+            };
+            navigator.notification.alert(object, callback);
+        },
+        'cb8947'
+    );
 
     // CB-8947 - ensure object messages don't crash iOS
-    createActionButton('Confirm Dialog with Object', function () {
-        var object = { number: 42, message: "Make sure an object doesn't crash iOS", issue: 'CB-8947' };
-        var callback = function () { clearLog(); console.log('Test passed'); };
-        navigator.notification.confirm(object, callback);
-    }, 'cb8947');
+    createActionButton(
+        'Confirm Dialog with Object',
+        function () {
+            var object = { number: 42, message: "Make sure an object doesn't crash iOS", issue: 'CB-8947' };
+            var callback = function () {
+                clearLog();
+                console.log('Test passed');
+            };
+            navigator.notification.confirm(object, callback);
+        },
+        'cb8947'
+    );
 
     // CB-8947 - ensure object messages don't crash iOS
-    createActionButton('Prompt Dialog with Object', function () {
-        var object = { number: 42, message: "Make sure an object doesn't crash iOS", issue: 'CB-8947' };
-        var callback = function () { clearLog(); console.log('Test passed'); };
-        navigator.notification.prompt(object, callback);
-    }, 'cb8947');
-
+    createActionButton(
+        'Prompt Dialog with Object',
+        function () {
+            var object = { number: 42, message: "Make sure an object doesn't crash iOS", issue: 'CB-8947' };
+            var callback = function () {
+                clearLog();
+                console.log('Test passed');
+            };
+            navigator.notification.prompt(object, callback);
+        },
+        'cb8947'
+    );
 };
diff --git a/www/android/notification.js b/www/android/notification.js
index 5562a9f..fcccff5 100644
--- a/www/android/notification.js
+++ b/www/android/notification.js
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
 var exec = require('cordova/exec');
 
@@ -33,7 +33,7 @@ module.exports = {
             message = 'Please wait...';
         }
 
-        exec(null, null, 'Notification', 'activityStart', [ title, message ]);
+        exec(null, null, 'Notification', 'activityStart', [title, message]);
     },
 
     /**
@@ -52,7 +52,7 @@ module.exports = {
      *            message Message to display in the dialog.
      */
     progressStart: function (title, message) {
-        exec(null, null, 'Notification', 'progressStart', [ title, message ]);
+        exec(null, null, 'Notification', 'progressStart', [title, message]);
     },
 
     /**
@@ -69,6 +69,6 @@ module.exports = {
      *            value 0-100
      */
     progressValue: function (value) {
-        exec(null, null, 'Notification', 'progressValue', [ value ]);
+        exec(null, null, 'Notification', 'progressValue', [value]);
     }
 };
diff --git a/www/browser/notification.js b/www/browser/notification.js
index f8bb065..efcc376 100644
--- a/www/browser/notification.js
+++ b/www/browser/notification.js
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
 // Platform: browser
 window.navigator.notification = window.navigator.notification || {};
@@ -34,13 +34,14 @@ module.exports.alert = window.navigator.notification.alert = function (message,
 
 module.exports.confirm = window.navigator.notification.confirm = function (message, callback) {
     // `notification.confirm` executes asynchronously
-    /* eslint-disable standard/no-callback-literal */
     setTimeout(function () {
         var result = window.confirm(message);
         if (callback) {
             if (result) {
+                // eslint-disable-next-line standard/no-callback-literal
                 callback(1); // OK
             } else {
+                // eslint-disable-next-line standard/no-callback-literal
                 callback(2); // Cancel
             }
         }
@@ -53,14 +54,16 @@ module.exports.prompt = window.navigator.notification.prompt = function (message
         var result = window.prompt(message, defaultText || '');
         if (callback) {
             if (result === null) {
+                // eslint-disable-next-line standard/no-callback-literal
                 callback({ buttonIndex: 2, input1: '' }); // Cancel
             } else {
+                // eslint-disable-next-line standard/no-callback-literal
                 callback({ buttonIndex: 1, input1: result }); // OK
             }
         }
     }, 0);
 };
-/* eslint-enable standard/no-callback-literal */
+
 var audioContext = (function () {
     // Determine if the Audio API is supported by this browser
     var AudioApi = window.AudioContext;
@@ -74,7 +77,7 @@ var audioContext = (function () {
     }
 
     return undefined;
-}());
+})();
 
 module.exports.beep = window.navigator.notification.beep = function (times) {
     if (times > 0) {
@@ -98,9 +101,8 @@ module.exports.beep = window.navigator.notification.beep = function (times) {
                         navigator.notification.beep(times);
                     }, BEEP_INTERVAL);
                 }
-
             }, BEEP_DURATION);
-        } else if (typeof (console) !== 'undefined' && typeof (console.log) === 'function') {
+        } else if (typeof console !== 'undefined' && typeof console.log === 'function') {
             // Audio API isn't supported, so just write `beep` to the console
             for (var i = 0; i < times; i++) {
                 console.log('Beep!');
diff --git a/www/notification.js b/www/notification.js
index 4a428d7..7ae7e31 100644
--- a/www/notification.js
+++ b/www/notification.js
@@ -17,7 +17,7 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
 var exec = require('cordova/exec');
 var platform = require('cordova/platform');
@@ -27,7 +27,6 @@ var platform = require('cordova/platform');
  */
 
 module.exports = {
-
     /**
      * Open a native alert dialog, with a customizable title and button text.
      *
@@ -37,9 +36,9 @@ module.exports = {
      * @param {String} buttonLabel          Label of the close button (default: OK)
      */
     alert: function (message, completeCallback, title, buttonLabel) {
-        var _message = (typeof message === 'string' ? message : JSON.stringify(message));
-        var _title = (typeof title === 'string' ? title : 'Alert');
-        var _buttonLabel = (buttonLabel && typeof buttonLabel === 'string' ? buttonLabel : 'OK');
+        var _message = typeof message === 'string' ? message : JSON.stringify(message);
+        var _title = typeof title === 'string' ? title : 'Alert';
+        var _buttonLabel = buttonLabel && typeof buttonLabel === 'string' ? buttonLabel : 'OK';
         exec(completeCallback, null, 'Notification', 'alert', [_message, _title, _buttonLabel]);
     },
 
@@ -53,13 +52,15 @@ module.exports = {
      * @param {Array} buttonLabels          Array of the labels of the buttons (default: ['OK', 'Cancel'])
      */
     confirm: function (message, resultCallback, title, buttonLabels) {
-        var _message = (typeof message === 'string' ? message : JSON.stringify(message));
-        var _title = (typeof title === 'string' ? title : 'Confirm');
-        var _buttonLabels = (buttonLabels || ['OK', 'Cancel']);
+        var _message = typeof message === 'string' ? message : JSON.stringify(message);
+        var _title = typeof title === 'string' ? title : 'Confirm';
+        var _buttonLabels = buttonLabels || ['OK', 'Cancel'];
 
         // Strings are deprecated!
         if (typeof _buttonLabels === 'string') {
-            console.log('Notification.confirm(string, function, string, string) is deprecated.  Use Notification.confirm(string, function, string, array).');
+            console.log(
+                'Notification.confirm(string, function, string, string) is deprecated.  Use Notification.confirm(string, function, string, array).'
+            );
         }
 
         _buttonLabels = convertButtonLabels(_buttonLabels);
@@ -80,18 +81,20 @@ module.exports = {
      * @param {String} defaultText          Textbox input value (default: empty string)
      */
     prompt: function (message, resultCallback, title, buttonLabels, defaultText) {
-        var _message = (typeof message === 'string' ? message : JSON.stringify(message));
-        var _title = (typeof title === 'string' ? title : 'Prompt');
-        var _buttonLabels = (buttonLabels || ['OK', 'Cancel']);
+        var _message = typeof message === 'string' ? message : JSON.stringify(message);
+        var _title = typeof title === 'string' ? title : 'Prompt';
+        var _buttonLabels = buttonLabels || ['OK', 'Cancel'];
 
         // Strings are deprecated!
         if (typeof _buttonLabels === 'string') {
-            console.log('Notification.prompt(string, function, string, string) is deprecated.  Use Notification.confirm(string, function, string, array).');
+            console.log(
+                'Notification.prompt(string, function, string, string) is deprecated.  Use Notification.confirm(string, function, string, array).'
+            );
         }
 
         _buttonLabels = convertButtonLabels(_buttonLabels);
 
-        var _defaultText = (defaultText || '');
+        var _defaultText = defaultText || '';
         exec(resultCallback, null, 'Notification', 'prompt', [_message, _title, _buttonLabels, _defaultText]);
     },
 
@@ -103,19 +106,24 @@ module.exports = {
      */
     beep: function (count) {
         var defaultedCount = count || 1;
-        exec(null, null, 'Notification', 'beep', [ defaultedCount ]);
+        exec(null, null, 'Notification', 'beep', [defaultedCount]);
     }
 };
 
 function convertButtonLabels (buttonLabels) {
-
     // Some platforms take an array of button label names.
     // Other platforms take a comma separated list.
     // For compatibility, we convert to the desired type based on the platform.
-    if (platform.id === 'amazon-fireos' || platform.id === 'android' || platform.id === 'ios' ||
-        platform.id === 'windowsphone' || platform.id === 'firefoxos' || platform.id === 'ubuntu' ||
-        platform.id === 'windows8' || platform.id === 'windows') {
-
+    if (
+        platform.id === 'amazon-fireos' ||
+        platform.id === 'android' ||
+        platform.id === 'ios' ||
+        platform.id === 'windowsphone' ||
+        platform.id === 'firefoxos' ||
+        platform.id === 'ubuntu' ||
+        platform.id === 'windows8' ||
+        platform.id === 'windows'
+    ) {
         if (typeof buttonLabels === 'string') {
             buttonLabels = buttonLabels.split(','); // not crazy about changing the var type here
         }


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