Set bootstrapScript and resourcePath params in URL.

This commit is contained in:
Cheng Zhao 2013-05-13 18:32:15 +08:00
parent 30b635527c
commit 3b87c5d84b

View File

@ -3,6 +3,8 @@ delegate = require 'atom_delegate'
path = require 'path'
Window = require 'window'
resourcePath = path.dirname(__dirname)
# All opened windows.
windows = []
@ -10,12 +12,24 @@ windows = []
app.on 'window-all-closed', ->
app.quit()
delegate.browserMainParts.preMainMessageLoopRun = ->
win = new Window width: 800, height: 600, show: false
win.loadUrl "file://#{__dirname}/../static/index.html"
openWindowWithParams = (pairs) ->
win = new Window width: 800, height: 600, show: false, title: 'Atom'
windows.push win
win.on 'destroyed', ->
windows.splice windows.indexOf(win), 1
windows.push win
url = "file://#{resourcePath}/static/index.html"
separator = '?'
for pair in pairs
url += "#{separator}#{pair.name}=#{pair.param}"
separator = '&' if separator is '?'
win.loadUrl url
win.show()
delegate.browserMainParts.preMainMessageLoopRun = ->
openWindowWithParams [
{name: 'bootstrapScript', param: 'window-bootstrap'},
{name: 'resourcePath', param: resourcePath},
]