Fallback to using the last argument as the callback
This commit is contained in:
parent
b2ad0a05d7
commit
400efa1b7d
1 changed files with 8 additions and 1 deletions
|
@ -20,18 +20,25 @@ var messageBoxOptions = {
|
||||||
noLink: 1 << 0
|
noLink: 1 << 0
|
||||||
}
|
}
|
||||||
|
|
||||||
var parseArgs = function (window, options, callback) {
|
var parseArgs = function (window, options, callback, ...args) {
|
||||||
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
|
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
|
||||||
// Shift.
|
// Shift.
|
||||||
callback = options
|
callback = options
|
||||||
options = window
|
options = window
|
||||||
window = null
|
window = null
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((callback == null) && typeof options === 'function') {
|
if ((callback == null) && typeof options === 'function') {
|
||||||
// Shift.
|
// Shift.
|
||||||
callback = options
|
callback = options
|
||||||
options = null
|
options = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback to using very last argument as the callback function
|
||||||
|
if ((callback == null) && typeof args[args.length - 1] === 'function') {
|
||||||
|
callback = args[args.length - 1]
|
||||||
|
}
|
||||||
|
|
||||||
return [window, options, callback]
|
return [window, options, callback]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue