From: Cheng Zhao Date: Wed, 23 Apr 2014 00:50:33 +0000 (+0800) Subject: Use closed event instead of destroyed event. X-Git-Tag: v0.12.0~18^2~12 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=5037daadfb6027741d075d924c5755651ec84099;p=electron.git Use closed event instead of destroyed event. We now do not delete window manually so the destroyed would be delayed until the object is GCed. --- diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index a359b282..94ca508b 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -19,7 +19,7 @@ BrowserWindow::_init = -> # Remove the window from weak map immediately when it's destroyed, since we # could be iterating windows before GC happended. - @once 'destroyed', -> + @once 'closed', -> BrowserWindow.windows.remove id if BrowserWindow.windows.has id # Tell the rpc server that a render view has been deleted and we need to diff --git a/spec/api-browser-window-spec.coffee b/spec/api-browser-window-spec.coffee index 6f8cab50..c67c873f 100644 --- a/spec/api-browser-window-spec.coffee +++ b/spec/api-browser-window-spec.coffee @@ -14,7 +14,7 @@ describe 'browser-window module', -> w.on 'loading-state-changed', (event, isLoading) -> if (!isLoading) w.close() - w.on 'destroyed', -> + w.on 'closed', -> test = path.join(fixtures, 'api', 'unload') content = fs.readFileSync(test) fs.unlinkSync(test)