diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index bf90f4776473..d76bfbf4283c 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -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() diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index b7726b590a78..cc413abed241 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -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.