]> khamidou — GitHub mirrors - electron.git/commitdiff
Avoid passing closures to browser when showing dialog.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 24 Apr 2014 04:07:03 +0000 (12:07 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 24 Apr 2014 04:26:28 +0000 (12:26 +0800)
It's resource-costy.

atom/renderer/lib/inspector.coffee

index 7a07d51dc06600683dd6545e8d356e27c32455d5..43a258234ffa0be82bf1f759f6a5b389d6fbf195 100644 (file)
@@ -51,8 +51,8 @@ createMenu = (items, event) ->
 showFileChooserDialog = (callback) ->
   remote = require 'remote'
   dialog = remote.require 'dialog'
-  dialog.showOpenDialog remote.getCurrentWindow(), null, (files) ->
-    callback pathToHtml5FileObject(files[0]) if files?
+  files = dialog.showOpenDialog remote.getCurrentWindow(), null
+  callback pathToHtml5FileObject files[0] if files?
 
 pathToHtml5FileObject = (path) ->
   fs = require 'fs'