From 400efa1b7dc6f44ce8252d1603ca8a9405454269 Mon Sep 17 00:00:00 2001
From: Kevin Sawicki <kevinsawicki@gmail.com>
Date: Thu, 31 Mar 2016 09:07:56 -0700
Subject: [PATCH] Fallback to using the last argument as the callback

---
 lib/browser/api/dialog.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/browser/api/dialog.js b/lib/browser/api/dialog.js
index 378822c6fb3..6669d8cab89 100644
--- a/lib/browser/api/dialog.js
+++ b/lib/browser/api/dialog.js
@@ -20,18 +20,25 @@ var messageBoxOptions = {
   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)) {
     // Shift.
     callback = options
     options = window
     window = null
   }
+
   if ((callback == null) && typeof options === 'function') {
     // Shift.
     callback = options
     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]
 }