Skip to content

Commit

Permalink
chore: remove unused arg parsing code in dialog (#17420)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Mar 18, 2019
1 parent 108545e commit f09f43a
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions lib/browser/api/dialog.js
Expand Up @@ -15,32 +15,6 @@ const fileDialogProperties = {
treatPackageAsDirectory: 1 << 7
}

const messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']

const messageBoxOptions = {
noLink: 1 << 0
}

const parseArgs = function (window, options, callback, ...args) {
if (window != null && window.constructor !== BrowserWindow) {
// Shift.
[callback, options, window] = [options, window, null]
}

if ((callback == null) && typeof options === 'function') {
// Shift.
[callback, options] = [options, null]
}

// Fallback to using very last argument as the callback function
const lastArgument = args[args.length - 1]
if ((callback == null) && typeof lastArgument === 'function') {
callback = lastArgument
}

return [window, options, callback]
}

const normalizeAccessKey = (text) => {
if (typeof text !== 'string') return text

Expand Down Expand Up @@ -144,6 +118,9 @@ const messageBox = (sync, window, options) => {
if (window && window.constructor !== BrowserWindow) options = window
if (options == null) options = { type: 'none' }

const messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']
const messageBoxOptions = { noLink: 1 << 0 }

let {
buttons = [],
cancelId,
Expand Down

0 comments on commit f09f43a

Please sign in to comment.