chore: remove unused arg parsing code in dialog (#17420)

This commit is contained in:
Shelley Vohr 2019-03-18 07:58:03 -07:00 committed by GitHub
parent 108545e416
commit f09f43a4a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
@ -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,