]> khamidou — GitHub mirrors - electron.git/commitdiff
Get webContents on request.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 25 Apr 2014 02:57:45 +0000 (10:57 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 25 Apr 2014 02:57:45 +0000 (10:57 +0800)
atom/browser/api/lib/browser-window.coffee

index d9cfb5ac47a84290079abea63e986fe2197a849e..1687604f2f97903d5e87fcd62ed8a5a286647039 100644 (file)
@@ -15,7 +15,9 @@ BrowserWindow::_init = ->
     @setMenu menu if menu?
 
   # Define getter for webContents.
-  @webContents = @getWebContents()
+  @__webContents = null
+  @__defineGetter__ 'webContents', ->
+    @__webContents ?= @getWebContents()
   @__devToolsWebContents = null
   @__defineGetter__ 'devToolsWebContents', ->
     if @isDevToolsOpened()