Add getter for devToolsWebContents.
This commit is contained in:
parent
00ed814962
commit
c5f8fbf471
5 changed files with 14 additions and 26 deletions
|
@ -14,7 +14,14 @@ BrowserWindow::_init = ->
|
|||
menu = app.getApplicationMenu()
|
||||
@setMenu menu if menu?
|
||||
|
||||
# Define getter for webContents.
|
||||
@webContents = @getWebContents()
|
||||
@__devToolsWebContents = null
|
||||
@__defineGetter__ 'devToolsWebContents', ->
|
||||
if @isDevToolsOpened()
|
||||
@__devToolsWebContents ?= @getDevToolsWebContents()
|
||||
else
|
||||
@__devToolsWebContents = null
|
||||
|
||||
# Remember the window.
|
||||
id = BrowserWindow.windows.add this
|
||||
|
@ -73,5 +80,10 @@ BrowserWindow::stop = -> @webContents.stop()
|
|||
BrowserWindow::getRoutingId = -> @webContents.getRoutingId()
|
||||
BrowserWindow::getProcessId = -> @webContents.getProcessId()
|
||||
BrowserWindow::isCrashed = -> @webContents.isCrashed()
|
||||
BrowserWindow::getDevTools = ->
|
||||
processId: @devToolsWebContents.getProcessId()
|
||||
routingId: @devToolsWebContents.getRoutingId()
|
||||
BrowserWindow::executeJavaScriptInDevTools = (code) ->
|
||||
@devToolsWebContents.executeJavaScript code
|
||||
|
||||
module.exports = BrowserWindow
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue