refactor: replace var with const / let (#14866)
This commit is contained in:
parent
b42493e6e6
commit
c61db523c7
26 changed files with 195 additions and 201 deletions
|
@ -86,13 +86,13 @@ exports.processStart = function () {
|
|||
// Download the releases specified by the URL and write new results to stdout.
|
||||
exports.checkForUpdate = function (updateURL, callback) {
|
||||
return spawnUpdate(['--checkForUpdate', updateURL], false, function (error, stdout) {
|
||||
var json, ref, ref1, update
|
||||
let ref, ref1, update
|
||||
if (error != null) {
|
||||
return callback(error)
|
||||
}
|
||||
try {
|
||||
// Last line of output is the JSON details about the releases
|
||||
json = stdout.trim().split('\n').pop()
|
||||
const json = stdout.trim().split('\n').pop()
|
||||
update = (ref = JSON.parse(json)) != null ? (ref1 = ref.releasesToApply) != null ? typeof ref1.pop === 'function' ? ref1.pop() : void 0 : void 0 : void 0
|
||||
} catch (jsonError) {
|
||||
// Disabled for backwards compatibility:
|
||||
|
|
|
@ -16,7 +16,7 @@ ipcMain.on('ELECTRON_SYNC_NAVIGATION_CONTROLLER', function (event, method, ...ar
|
|||
// control on user land, and only rely on WebContents.loadURL for navigation.
|
||||
// This helps us avoid Chromium's various optimizations so we can ensure renderer
|
||||
// process is restarted everytime.
|
||||
var NavigationController = (function () {
|
||||
const NavigationController = (function () {
|
||||
function NavigationController (webContents) {
|
||||
this.webContents = webContents
|
||||
this.clearHistory()
|
||||
|
@ -141,7 +141,7 @@ var NavigationController = (function () {
|
|||
}
|
||||
|
||||
NavigationController.prototype.goToOffset = function (offset) {
|
||||
var pendingIndex
|
||||
let pendingIndex
|
||||
if (!this.canGoToOffset(offset)) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ const util = require('util')
|
|||
const Module = require('module')
|
||||
const v8 = require('v8')
|
||||
|
||||
// We modified the original process.argv to let node.js load the atom.js,
|
||||
// We modified the original process.argv to let node.js load the init.js,
|
||||
// we need to restore it here.
|
||||
process.argv.splice(1, 1)
|
||||
|
||||
|
@ -17,7 +17,7 @@ require('../common/reset-search-paths')
|
|||
// Import common settings.
|
||||
require('@electron/internal/common/init')
|
||||
|
||||
var globalPaths = Module.globalPaths
|
||||
const globalPaths = Module.globalPaths
|
||||
|
||||
// Expose public APIs.
|
||||
globalPaths.push(path.join(__dirname, 'api', 'exports'))
|
||||
|
@ -25,10 +25,10 @@ globalPaths.push(path.join(__dirname, 'api', 'exports'))
|
|||
if (process.platform === 'win32') {
|
||||
// Redirect node's console to use our own implementations, since node can not
|
||||
// handle console output when running as GUI program.
|
||||
var consoleLog = function (...args) {
|
||||
const consoleLog = function (...args) {
|
||||
return process.log(util.format(...args) + '\n')
|
||||
}
|
||||
var streamWrite = function (chunk, encoding, callback) {
|
||||
const streamWrite = function (chunk, encoding, callback) {
|
||||
if (Buffer.isBuffer(chunk)) {
|
||||
chunk = chunk.toString(encoding)
|
||||
}
|
||||
|
@ -45,15 +45,14 @@ if (process.platform === 'win32') {
|
|||
// Don't quit on fatal error.
|
||||
process.on('uncaughtException', function (error) {
|
||||
// Do nothing if the user has a custom uncaught exception handler.
|
||||
var dialog, message, ref, stack
|
||||
if (process.listeners('uncaughtException').length > 1) {
|
||||
return
|
||||
}
|
||||
|
||||
// Show error in GUI.
|
||||
dialog = require('electron').dialog
|
||||
stack = (ref = error.stack) != null ? ref : error.name + ': ' + error.message
|
||||
message = 'Uncaught Exception:\n' + stack
|
||||
const dialog = require('electron').dialog
|
||||
const stack = error.stack ? error.stack : `${error.name}: ${error.message}`
|
||||
const message = 'Uncaught Exception:\n' + stack
|
||||
dialog.showErrorBox('A JavaScript error occurred in the main process', message)
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue