Add "dev-tools-opened" and "dev-tools-closed" events.

This commit is contained in:
Cheng Zhao 2014-08-28 14:25:00 +08:00
parent 8051ad8b2a
commit a59388ecdd
2 changed files with 12 additions and 0 deletions

View file

@ -35,6 +35,10 @@ BrowserWindow::openDevTools = ->
@devToolsWebContents = @getDevToolsWebContents()
@devToolsWebContents.once 'destroyed', => @devToolsWebContents = null
# Emit devtools events.
@emit 'dev-tools-opened'
@devToolsWebContents.once 'destroyed', => @emit 'dev-tools-closed'
BrowserWindow::toggleDevTools = ->
if @isDevToolsOpened() then @closeDevTools() else @openDevTools()

View file

@ -138,6 +138,14 @@ Emitted when window loses focus.
Emitted when window gains focus.
### Event: 'dev-tools-opened'
Emitted when devtools is opened.
### Event: 'dev-tools-closed'
Emitted when devtools is closed.
### Class Method: BrowserWindow.getAllWindows()
Returns an array of all opened browser windows.