Make a few window related atom.* functions work.

This commit is contained in:
Cheng Zhao
2013-05-20 11:53:06 +08:00
parent 8be54136ed
commit 0ad96ca7da
2 changed files with 10 additions and 8 deletions

View File

@@ -148,8 +148,8 @@ window.atom =
openDev: (url) ->
console.error("atom.openDev does not work yet")
newWindow: (args...) ->
@sendMessageToBrowserProcess('newWindow', args)
newWindow: ->
ipc.sendChannel('new-window')
openConfig: ->
@sendMessageToBrowserProcess('openConfig')
@@ -204,15 +204,13 @@ window.atom =
@pendingModals[stackSize - 1].shift()
openDevTools: ->
currentWindow = require('remote').getCurrentWindow()
currentWindow.openDevTools()
remote.getCurrentWindow().openDevTools()
toggleDevTools: ->
currentWindow = require('remote').getCurrentWindow()
currentWindow.toggleDevTools()
remote.getCurrentWindow().toggleDevTools()
focus: ->
@sendMessageToBrowserProcess('focus')
remote.getCurrentWindow().focus()
exit: (status) ->
@sendMessageToBrowserProcess('exit', [status])
@@ -227,7 +225,8 @@ window.atom =
@sendMessageToBrowserProcess('endTracing')
toggleFullScreen: ->
@sendMessageToBrowserProcess('toggleFullScreen')
currentWindow = remote.getCurrentWindow()
currentWindow.setFullscreen(!currentWindow.isFullscreen())
sendMessageToBrowserProcess: (name, data=[], callbacks) ->
throw new Error("sendMessageToBrowserProcess no longer works for #{name}")

View File

@@ -126,6 +126,9 @@ class AtomApplication
console.log paths
@createAtomWindow(path) for path in paths
ipc.on 'new-window', =>
@createAtomWindow()
createAtomWindow: (path) ->
new AtomWindow
path: path