.SetMethod("flashFrame", &Window::FlashFrame)
.SetMethod("setKiosk", &Window::SetKiosk)
.SetMethod("isKiosk", &Window::IsKiosk)
- .SetMethod("openDevTools", &Window::OpenDevTools)
+ .SetMethod("_openDevTools", &Window::OpenDevTools)
.SetMethod("closeDevTools", &Window::CloseDevTools)
.SetMethod("isDevToolsOpened", &Window::IsDevToolsOpened)
.SetMethod("inspectElement", &Window::InspectElement)
@webContents = @getWebContents()
@webContents.once 'destroyed', => @webContents = null
- # Define getter for devToolsWebContents.
- devToolsWebContents = null
- @__defineGetter__ 'devToolsWebContents', ->
- if @isDevToolsOpened()
- # Get a new devToolsWebContents if previous one has been destroyed, it
- # could happen when the devtools has been closed and then reopened.
- devToolsWebContents = null unless devToolsWebContents?.isAlive()
- devToolsWebContents ?= @getDevToolsWebContents()
- else
- devToolsWebContents = null
-
# Remember the window.
id = BrowserWindow.windows.add this
@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
- # release all objects owned by it.
- @webContents.on 'render-view-deleted', (event, processId, routingId) ->
- process.emit 'ATOM_BROWSER_RELEASE_RENDER_VIEW', "#{processId}-#{routingId}"
+BrowserWindow::openDevTools = ->
+ @_openDevTools()
+
+ # Force devToolsWebContents to be created.
+ @devToolsWebContents = @getDevToolsWebContents()
+ @devToolsWebContents.once 'destroyed', => @devToolsWebContents = null
BrowserWindow::toggleDevTools = ->
if @isDevToolsOpened() then @closeDevTools() else @openDevTools()
webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}"
webContents.equal = (other) -> @getId() is other.getId()
+ # Tell the rpc server that a render view has been deleted and we need to
+ # release all objects owned by it.
+ webContents.on 'render-view-deleted', (event, processId, routingId) ->
+ process.emit 'ATOM_BROWSER_RELEASE_RENDER_VIEW', "#{processId}-#{routingId}"
+
# Dispatch IPC messages to the ipc module.
webContents.on 'ipc-message', (event, channel, args...) =>
Object.defineProperty event, 'sender', value: webContents