mirror of
https://github.com/HackPlan/atom-shell.git
synced 2026-04-23 11:27:58 +08:00
Add BrowserWindow.getFocusedWindow() API.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
EventEmitter = require('events').EventEmitter
|
||||
objectsRegistry = require '../../atom/objects_registry.js'
|
||||
|
||||
BrowserWindow = process.atomBinding('window').BrowserWindow
|
||||
BrowserWindow.prototype.__proto__ = EventEmitter.prototype
|
||||
|
||||
BrowserWindow.getFocusedWindow = ->
|
||||
windows = objectsRegistry.getAllWindows()
|
||||
return window for window in windows when window.isFocused()
|
||||
|
||||
module.exports = BrowserWindow
|
||||
|
||||
@@ -69,10 +69,12 @@ delegate.browserMainParts.preMainMessageLoopRun = function() {
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'Command+R',
|
||||
click: function() { BrowserWindow.getFocusedWindow().reloadIgnoringCache(); }
|
||||
},
|
||||
{
|
||||
label: 'Show DevTools',
|
||||
accelerator: 'Alt+Command+I',
|
||||
click: function() { BrowserWindow.getFocusedWindow().openDevTools(); }
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user