mirror of
https://github.com/atom/atom.git
synced 2026-02-11 23:25:03 -05:00
We need to avoid using the module for synchronous IPC on startup, but in some cases, we need to know when our asynchronous IPC messages have taken effect. Now, methods like and return Promises that indicate when the message has been processed.
34 lines
1.2 KiB
CoffeeScript
34 lines
1.2 KiB
CoffeeScript
# Like sands through the hourglass, so are the days of our lives.
|
|
module.exports = ({blobStore}) ->
|
|
path = require 'path'
|
|
require './window'
|
|
{getWindowLoadSettings} = require './window-load-settings-helpers'
|
|
|
|
{resourcePath, isSpec, devMode} = getWindowLoadSettings()
|
|
|
|
# Add application-specific exports to module search path.
|
|
exportsPath = path.join(resourcePath, 'exports')
|
|
require('module').globalPaths.push(exportsPath)
|
|
process.env.NODE_PATH = exportsPath
|
|
|
|
# Make React faster
|
|
process.env.NODE_ENV ?= 'production' unless devMode
|
|
|
|
AtomEnvironment = require './atom-environment'
|
|
ApplicationDelegate = require './application-delegate'
|
|
window.atom = new AtomEnvironment({
|
|
window, document, blobStore,
|
|
applicationDelegate: new ApplicationDelegate,
|
|
configDirPath: process.env.ATOM_HOME
|
|
enablePersistence: true
|
|
})
|
|
|
|
atom.displayWindow().then ->
|
|
atom.startEditorWindow()
|
|
|
|
# Workaround for focus getting cleared upon window creation
|
|
windowFocused = ->
|
|
window.removeEventListener('focus', windowFocused)
|
|
setTimeout (-> document.querySelector('atom-workspace').focus()), 0
|
|
window.addEventListener('focus', windowFocused)
|