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 d9cfb5a..1687604 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()