mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Request loadSettings.windowState via IPC messages.
This commit is contained in:
@@ -94,7 +94,14 @@ class Atom extends Model
|
||||
|
||||
# Private: Returns the load settings hash associated with the current window.
|
||||
@getLoadSettings: ->
|
||||
_.deepClone(@loadSettings ?= JSON.parse(decodeURIComponent(location.search.substr(14))))
|
||||
@loadSettings ?= JSON.parse(decodeURIComponent(location.search.substr(14)))
|
||||
cloned = _.deepClone(@loadSettings)
|
||||
# The loadSettings.windowState could be large, request it only when needed.
|
||||
cloned.__defineGetter__ 'windowState', =>
|
||||
@getCurrentWindow().loadSettings.windowState
|
||||
cloned.__defineSetter__ 'windowState', (value) =>
|
||||
@getCurrentWindow().loadSettings.windowState = value
|
||||
cloned
|
||||
|
||||
# Private:
|
||||
@getCurrentWindow: ->
|
||||
|
||||
@@ -55,12 +55,16 @@ class AtomWindow
|
||||
process.env['NODE_PATH'] = path.resolve(resourcePath, 'exports')
|
||||
|
||||
getUrl: (loadSettingsObj) ->
|
||||
loadSettings = JSON.stringify(loadSettingsObj)
|
||||
# Ignore the windowState when passing loadSettings via URL, since it could
|
||||
# be quite large.
|
||||
loadSettings = _.clone(loadSettingsObj)
|
||||
delete loadSettings['windowState']
|
||||
|
||||
url.format
|
||||
protocol: 'file'
|
||||
pathname: "#{@resourcePath}/static/index.html"
|
||||
slashes: true
|
||||
query: {loadSettings}
|
||||
query: {loadSettings: JSON.stringify(loadSettings)}
|
||||
|
||||
getInitialPath: ->
|
||||
@browserWindow.loadSettings.initialPath
|
||||
|
||||
Reference in New Issue
Block a user