Avoid passing closures to browser when showing dialog.

It's resource-costy.
This commit is contained in:
Cheng Zhao 2014-04-24 12:07:03 +08:00
parent 9091a34675
commit 83debe2e43

View 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'