From 42e7ee2b4aef6de396927d16e6429a6ec44dd681 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 28 Mar 2016 18:00:30 -0700 Subject: [PATCH] finish standardizing! --- default_app/main.js | 7 ++++--- lib/browser/api/app.js | 2 +- lib/browser/api/auto-updater/squirrel-update-win.js | 4 ++-- lib/browser/api/browser-window.js | 7 +++---- lib/browser/api/menu-item.js | 13 ++++++++++++- lib/common/asar.js | 2 -- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/default_app/main.js b/default_app/main.js index dcbe2ca0c65..43c8d729804 100644 --- a/default_app/main.js +++ b/default_app/main.js @@ -243,7 +243,7 @@ function loadApplicationPackage (packagePath) { } else if (packageJson.name) { app.setName(packageJson.name) } - + app.setPath('userData', path.join(app.getPath('appData'), app.getName())) app.setPath('userCache', path.join(app.getPath('cache'), app.getName())) app.setAppPath(packagePath) @@ -251,7 +251,7 @@ function loadApplicationPackage (packagePath) { // Run the app. require('module')._load(packagePath, module, true) - } catch(e) { + } catch (e) { if (e.code === 'MODULE_NOT_FOUND') { app.focus() dialog.showErrorBox( @@ -319,5 +319,6 @@ if (option.file && !option.webdriver) { } else if (option.interactive) { startRepl() } else { - loadApplicationByUrl('file://' + __dirname + '/index.html') + var indexPath = path.join(__dirname, '/index.html') + loadApplicationByUrl(`file://${indexPath}`) } diff --git a/lib/browser/api/app.js b/lib/browser/api/app.js index c2e2899e77c..48a27cfc648 100644 --- a/lib/browser/api/app.js +++ b/lib/browser/api/app.js @@ -45,7 +45,7 @@ if (process.platform === 'darwin') { var appPath = null app.setAppPath = function (path) { - return appPath = path + appPath = path } app.getAppPath = function () { diff --git a/lib/browser/api/auto-updater/squirrel-update-win.js b/lib/browser/api/auto-updater/squirrel-update-win.js index d4f2d98ca50..da27e02aab6 100644 --- a/lib/browser/api/auto-updater/squirrel-update-win.js +++ b/lib/browser/api/auto-updater/squirrel-update-win.js @@ -30,10 +30,10 @@ var spawnUpdate = function (args, detached, callback) { stdout = '' stderr = '' spawnedProcess.stdout.on('data', function (data) { - return stdout += data + stdout += data }) spawnedProcess.stderr.on('data', function (data) { - return stderr += data + stderr += data }) errorEmitted = false spawnedProcess.on('error', function (error) { diff --git a/lib/browser/api/browser-window.js b/lib/browser/api/browser-window.js index a00fef3b453..7bbf898dafb 100644 --- a/lib/browser/api/browser-window.js +++ b/lib/browser/api/browser-window.js @@ -53,12 +53,11 @@ BrowserWindow.prototype._init = function () { this.webContents.on('page-title-updated', (event, title) => { // The page-title-updated event is not emitted immediately (see #3645), so // when the callback is called the BrowserWindow might have been closed. - if (this.isDestroyed()) - return + if (this.isDestroyed()) return + // Route the event to BrowserWindow. this.emit('page-title-updated', event, title) - if (!event.defaultPrevented) - this.setTitle(title) + if (!event.defaultPrevented) this.setTitle(title) }) // Sometimes the webContents doesn't get focus when window is shown, so we have diff --git a/lib/browser/api/menu-item.js b/lib/browser/api/menu-item.js index 62622317bbb..20666b0f36e 100644 --- a/lib/browser/api/menu-item.js +++ b/lib/browser/api/menu-item.js @@ -29,7 +29,18 @@ MenuItem = (function () { function MenuItem (options) { var click, ref const Menu = require('electron').Menu - click = options.click, this.selector = options.selector, this.type = options.type, this.role = options.role, this.label = options.label, this.sublabel = options.sublabel, this.accelerator = options.accelerator, this.icon = options.icon, this.enabled = options.enabled, this.visible = options.visible, this.checked = options.checked, this.submenu = options.submenu + click = options.click + this.selector = options.selector + this.type = options.type + this.role = options.role + this.label = options.label + this.sublabel = options.sublabel + this.accelerator = options.accelerator + this.icon = options.icon + this.enabled = options.enabled + this.visible = options.visible + this.checked = options.checked + this.submenu = options.submenu if ((this.submenu != null) && this.submenu.constructor !== Menu) { this.submenu = Menu.buildFromTemplate(this.submenu) } diff --git a/lib/common/asar.js b/lib/common/asar.js index f79075ce23d..26241281322 100644 --- a/lib/common/asar.js +++ b/lib/common/asar.js @@ -1,5 +1,3 @@ -/* globals $ */ - (function () { const asar = process.binding('atom_common_asar') const child_process = require('child_process')