Add app.getBrowserWindows() API.
This commit is contained in:
parent
61cc0bba25
commit
666f6b3a01
3 changed files with 11 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
||||||
bindings = process.atomBinding 'app'
|
bindings = process.atomBinding 'app'
|
||||||
|
objectsRegistry = require '../../atom/objects-registry.js'
|
||||||
EventEmitter = require('events').EventEmitter
|
EventEmitter = require('events').EventEmitter
|
||||||
|
|
||||||
Application = bindings.Application
|
Application = bindings.Application
|
||||||
|
@ -9,6 +10,9 @@ app = new Application
|
||||||
app.getHomeDir = ->
|
app.getHomeDir = ->
|
||||||
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
|
process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
|
||||||
|
|
||||||
|
app.getBrowserWindows = ->
|
||||||
|
objectsRegistry.getAllWindows()
|
||||||
|
|
||||||
app.commandLine =
|
app.commandLine =
|
||||||
appendSwitch: bindings.appendSwitch,
|
appendSwitch: bindings.appendSwitch,
|
||||||
appendArgument: bindings.appendArgument
|
appendArgument: bindings.appendArgument
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
EventEmitter = require('events').EventEmitter
|
EventEmitter = require('events').EventEmitter
|
||||||
|
app = require 'app'
|
||||||
v8Util = process.atomBinding 'v8_util'
|
v8Util = process.atomBinding 'v8_util'
|
||||||
objectsRegistry = require '../../atom/objects-registry.js'
|
|
||||||
|
|
||||||
BrowserWindow = process.atomBinding('window').BrowserWindow
|
BrowserWindow = process.atomBinding('window').BrowserWindow
|
||||||
BrowserWindow::__proto__ = EventEmitter.prototype
|
BrowserWindow::__proto__ = EventEmitter.prototype
|
||||||
|
@ -26,11 +26,11 @@ BrowserWindow::setMenu = (menu) ->
|
||||||
@menu.attachToWindow this
|
@menu.attachToWindow this
|
||||||
|
|
||||||
BrowserWindow.getFocusedWindow = ->
|
BrowserWindow.getFocusedWindow = ->
|
||||||
windows = objectsRegistry.getAllWindows()
|
windows = app.getBrowserWindows()
|
||||||
return window for window in windows when window.isFocused()
|
return window for window in windows when window.isFocused()
|
||||||
|
|
||||||
BrowserWindow.fromProcessIdAndRoutingId = (processId, routingId) ->
|
BrowserWindow.fromProcessIdAndRoutingId = (processId, routingId) ->
|
||||||
windows = objectsRegistry.getAllWindows()
|
windows = app.getBrowserWindows()
|
||||||
return window for window in windows when window.getProcessId() == processId and
|
return window for window in windows when window.getProcessId() == processId and
|
||||||
window.getRoutingId() == routingId
|
window.getRoutingId() == routingId
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,10 @@ code will not run.
|
||||||
|
|
||||||
Returns the version of current bundle or executable.
|
Returns the version of current bundle or executable.
|
||||||
|
|
||||||
|
## app.getBrowserWindows()
|
||||||
|
|
||||||
|
Returns an array of all browser windows.
|
||||||
|
|
||||||
## app.commandLine.appendSwitch(switch, [value])
|
## app.commandLine.appendSwitch(switch, [value])
|
||||||
|
|
||||||
Append a switch [with optional value] to Chromium's command line.
|
Append a switch [with optional value] to Chromium's command line.
|
||||||
|
|
Loading…
Reference in a new issue