]> khamidou — GitHub mirrors - electron.git/commitdiff
Add destroyed event for webContents.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 25 Apr 2014 03:59:33 +0000 (11:59 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 25 Apr 2014 03:59:33 +0000 (11:59 +0800)
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/lib/browser-window.coffee

index 52c6735dfff055111c2cca1ba5e965241d42d049..9205bdf8b4c0450affcd28a4c091417965c851ad 100644 (file)
@@ -39,6 +39,7 @@ void WebContents::WebContentsDestroyed(content::WebContents*) {
   // directly.
   RenderViewDeleted(web_contents_->GetRenderViewHost());
 
+  Emit("destroyed");
   web_contents_ = NULL;
 }
 
index 8db7680ad2e21f7455238815e1c7913b7960d494..c357078a9c104da64fa2553231d026f01caae835 100644 (file)
@@ -15,6 +15,7 @@ BrowserWindow::_init = ->
     @setMenu menu if menu?
 
   @webContents = @getWebContents()
+  @webContents.once 'destroyed', => @webContents = null
 
   # Define getter for devToolsWebContents.
   devToolsWebContents = null