From: Cheng Zhao Date: Thu, 24 Apr 2014 04:07:03 +0000 (+0800) Subject: Avoid passing closures to browser when showing dialog. X-Git-Tag: v0.12.0~16 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=83debe2e438958b0cb4885f949639f97033b8d66;p=electron.git Avoid passing closures to browser when showing dialog. It's resource-costy. --- diff --git a/atom/renderer/lib/inspector.coffee b/atom/renderer/lib/inspector.coffee index 7a07d51d..43a25823 100644 --- a/atom/renderer/lib/inspector.coffee +++ b/atom/renderer/lib/inspector.coffee @@ -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'