Repository: atom/atom
File: src/main-process/atom-window.js (JavaScript)

Code before:
      webPreferences: {
        // Prevent specs from throttling when the window is in the background:
        // this should result in faster CI builds, and an improvement in the
        // local development experience when running specs through the UI (which
        // now won't pause when e.g. minimizing the window).
        backgroundThrottling: !this.isSpec,
        // Disable the `auxclick` feature so that `click` events are triggered in
        // response to a middle-click.
        // (Ref: https://github.com/atom/atom/pull/12696#issuecomment-290496960)
        disableBlinkFeatures: 'Auxclick'
      }
    }

    // Don't set icon on Windows so the exe's ico will be used as window and
    // taskbar's icon. See https://github.com/atom/atom/issues/4811 for more.
    if (process.platform === 'linux') options.icon = ICON_PATH
    if (this.shouldAddCustomTitleBar()) options.titleBarStyle = 'hidden'
    if (this.shouldAddCustomInsetTitleBar()) options.titleBarStyle = 'hidden-inset'
    if (this.shouldHideTitleBar()) options.frame = false
    this.browserWindow = new BrowserWindow(options)

    Object.defineProperty(this.browserWindow, 'loadSettingsJSON', {
      get: () => JSON.stringify(Object.assign({
        userSettings: this.atomApplication.configFile.get(),
        projectSettings: this.projectSettings
      }, this.loadSettings))
    })

    this.handleEvents()

    this.loadSettings = Object.assign({}, settings)
    this.loadSettings.appVersion = app.getVersion()
    this.loadSettings.resourcePath = this.resourcePath
    this.loadSettings.atomHome = process.env.ATOM_HOME
    if (this.loadSettings.devMode == null) this.loadSettings.devMode = false
    if (this.loadSettings.safeMode == null) this.loadSettings.safeMode = false
    if (this.loadSettings.clearWindowState == null) this.loadSettings.clearWindowState = false

    if (!this.loadSettings.initialPaths) {
      this.loadSettings.initialPaths = []
      for (const {pathToOpen, stat} of locationsToOpen) {
        if (!pathToOpen) continue
        if (stat && stat.isDirectory()) {
          this.loadSettings.initialPaths.push(pathToOpen)
        } else {
          const parentDirectory = path.dirname(pathToOpen)
          if (stat && stat.isFile() || fs.existsSync(parentDirectory)) {
            this.loadSettings.initialPaths.push(parentDirectory)
          } else {
            this.loadSettings.initialPaths.push(pathToOpen)
          }

Review comment (suggestion):
Now that this isn't configurable anymore, could we just remove it and define it as a regular getter method like

```js
constructor () {
  // ...
}

get loadSettingsJSON () {
  return JSON.stringify(/* ... */)
}
```

Code after:
      webPreferences: {
        // Prevent specs from throttling when the window is in the background:
        // this should result in faster CI builds, and an improvement in the
        // local development experience when running specs through the UI (which
        // now won't pause when e.g. minimizing the window).
        backgroundThrottling: !this.isSpec,
        // Disable the `auxclick` feature so that `click` events are triggered in
        // response to a middle-click.
        // (Ref: https://github.com/atom/atom/pull/12696#issuecomment-290496960)
        disableBlinkFeatures: 'Auxclick'
      }
    }

    // Don't set icon on Windows so the exe's ico will be used as window and
    // taskbar's icon. See https://github.com/atom/atom/issues/4811 for more.
    if (process.platform === 'linux') options.icon = ICON_PATH
    if (this.shouldAddCustomTitleBar()) options.titleBarStyle = 'hidden'
    if (this.shouldAddCustomInsetTitleBar()) options.titleBarStyle = 'hidden-inset'
    if (this.shouldHideTitleBar()) options.frame = false
    this.browserWindow = new BrowserWindow(options)

    Object.defineProperty(this.browserWindow, 'loadSettingsJSON', {
      get: () => JSON.stringify(Object.assign({
        userSettings: !this.isSpec
          ? this.atomApplication.configFile.get()
          : null,
        projectSpecification: this.projectSpecification
      }, this.loadSettings))
    })

    this.handleEvents()

    this.loadSettings = Object.assign({}, settings)
    this.loadSettings.appVersion = app.getVersion()
    this.loadSettings.resourcePath = this.resourcePath
    this.loadSettings.atomHome = process.env.ATOM_HOME
    if (this.loadSettings.devMode == null) this.loadSettings.devMode = false
    if (this.loadSettings.safeMode == null) this.loadSettings.safeMode = false
    if (this.loadSettings.clearWindowState == null) this.loadSettings.clearWindowState = false

    if (!this.loadSettings.initialPaths) {
      this.loadSettings.initialPaths = []
      for (const {pathToOpen, stat} of locationsToOpen) {
        if (!pathToOpen) continue
        if (stat && stat.isDirectory()) {
          this.loadSettings.initialPaths.push(pathToOpen)
        } else {
          const parentDirectory = path.dirname(pathToOpen)
          if (stat && stat.isFile() || fs.existsSync(parentDirectory)) {
            this.loadSettings.initialPaths.push(parentDirectory)
          } else {