]> khamidou — GitHub mirrors - electron.git/commitdiff
Use `const`
authorJessica Lord <jlord@github.com>
Thu, 14 Jan 2016 21:16:42 +0000 (13:16 -0800)
committerJessica Lord <jlord@github.com>
Thu, 14 Jan 2016 22:26:10 +0000 (14:26 -0800)
atom/browser/api/lib/app.js
atom/browser/api/lib/auto-updater.js
atom/browser/api/lib/auto-updater/auto-updater-native.js
atom/browser/api/lib/auto-updater/auto-updater-win.js
atom/browser/api/lib/auto-updater/squirrel-update-win.js
atom/browser/api/lib/browser-window.js
atom/browser/api/lib/dialog.js
atom/browser/api/lib/exports/electron.js
atom/browser/api/lib/ipc-main.js
atom/browser/api/lib/ipc.js

index 560fcb8630ee3263e778863d7f927b4c0644f0ef..bd820127cd9a262e0814580911b7a465af2e8eef 100644 (file)
@@ -1,15 +1,21 @@
-var EventEmitter, Menu, app, appPath, bindings, deprecate, downloadItemBindings, fn, i, len, name, ref, ref1, session, wrapDownloadItem,
-  slice = [].slice;
-
-ref = require('electron'), deprecate = ref.deprecate, session = ref.session, Menu = ref.Menu;
-
-EventEmitter = require('events').EventEmitter;
-
-bindings = process.atomBinding('app');
-
-downloadItemBindings = process.atomBinding('download_item');
-
-app = bindings.app;
+const deprecate = require('electron').deprecate;
+const session = require('electron').session;
+const Menu = require('electron').Menu;
+const EventEmitter = require('events').EventEmitter;
+
+const bindings = process.atomBinding('app');
+const downloadItemBindings = process.atomBinding('download_item');
+const app = bindings.app;
+
+var slice = [].slice;
+
+var appPath;
+var fn;
+var i;
+var len;
+var name;
+var ref1;
+var wrapDownloadItem;
 
 app.__proto__ = EventEmitter.prototype;
 
index a3ffc12e9f2ddd4d74bd2303dd810109c1095b62..9cc1fada067577bb53800f9970f88ed7fe8b3763 100644 (file)
@@ -1,8 +1,5 @@
-var autoUpdater, deprecate;
-
-deprecate = require('electron').deprecate;
-
-autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
+const deprecate = require('electron').deprecate;
+const autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
 
 // Deprecated.
 deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');
index 9f22b33feb1d7a7145a37f0a7169eab88ddd526c..20c69cdb5a2b729dd2a99b25abb144a5a44e6fc1 100644 (file)
@@ -1,8 +1,5 @@
-var EventEmitter, autoUpdater;
-
-EventEmitter = require('events').EventEmitter;
-
-autoUpdater = process.atomBinding('auto_updater').autoUpdater;
+const EventEmitter = require('events').EventEmitter;
+const autoUpdater = process.atomBinding('auto_updater').autoUpdater;
 
 autoUpdater.__proto__ = EventEmitter.prototype;
 
index 61b1911e232ea492fbbbe7abc95be0466e0f3ef2..bbe02555a0b861bb58a99633fee4df5a5dab079e 100644 (file)
@@ -1,16 +1,12 @@
-var AutoUpdater, EventEmitter, app, squirrelUpdate, url,
-  extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
-  hasProp = {}.hasOwnProperty;
+const app = require('electron').app;
+const EventEmitter = require('events').EventEmitter;
+const url = require('url');
+const squirrelUpdate = require('./squirrel-update-win');
 
-app = require('electron').app;
+var extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+hasProp = {}.hasOwnProperty;
 
-EventEmitter = require('events').EventEmitter;
-
-url = require('url');
-
-squirrelUpdate = require('./squirrel-update-win');
-
-AutoUpdater = (function(superClass) {
+var AutoUpdater = (function(superClass) {
   extend(AutoUpdater, superClass);
 
   function AutoUpdater() {
index 49d525f4a684db59d9f19c25ffc8b9b059a3d738..8fe8a3786db91a21e3764bd6e48806da898de216 100644 (file)
@@ -1,22 +1,18 @@
-var appFolder, exeName, fs, path, spawn, spawnUpdate, updateExe;
-
-fs = require('fs');
-
-path = require('path');
-
-spawn = require('child_process').spawn;
+const fs = require('fs');
+const path = require('path');
+const spawn = require('child_process').spawn;
 
 // i.e. my-app/app-0.1.13/
-appFolder = path.dirname(process.execPath);
+const appFolder = path.dirname(process.execPath);
 
 // i.e. my-app/Update.exe
-updateExe = path.resolve(appFolder, '..', 'Update.exe');
+const updateExe = path.resolve(appFolder, '..', 'Update.exe');
 
-exeName = path.basename(process.execPath);
+const exeName = path.basename(process.execPath);
 
 // Spawn a command and invoke the callback when it completes with an error
 // and the output from standard out.
-spawnUpdate = function(args, detached, callback) {
+var spawnUpdate = function(args, detached, callback) {
   var error, error1, errorEmitted, spawnedProcess, stderr, stdout;
   try {
     spawnedProcess = spawn(updateExe, args, {
index df9ae1647383bef79f5f4014fe9dd8764c3f23e1..1268b0f80127d1456ee6e85343db38e8d857928a 100644 (file)
@@ -1,10 +1,7 @@
-var BrowserWindow, EventEmitter, deprecate, ipcMain, ref;
-
-ref = require('electron'), ipcMain = ref.ipcMain, deprecate = ref.deprecate;
-
-EventEmitter = require('events').EventEmitter;
-
-BrowserWindow = process.atomBinding('window').BrowserWindow;
+const ipcMain = require('electron').ipcMain;
+const deprecate = require('electron').deprecate;
+const EventEmitter = require('events').EventEmitter;
+const BrowserWindow = process.atomBinding('window').BrowserWindow;
 
 BrowserWindow.prototype.__proto__ = EventEmitter.prototype;
 
index 9ed49738a55b5f38f18bc5702234ddb82a29b0f3..302fa7bf07fe4bd6c61f6843a3a118bfe2e67cb0 100644 (file)
@@ -1,27 +1,25 @@
-var BrowserWindow, api, app, binding, checkAppInitialized, fileDialogProperties, j, len, messageBoxOptions, messageBoxTypes, parseArgs, ref, ref1, v8Util,
-  slice = [].slice,
-  indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+const app = require('electron').app;
+const BrowserWindow = require('electron').BrowserWindow;
+const binding = process.atomBinding('dialog');
+const v8Util = process.atomBinding('v8_util');
 
-ref = require('electron'), app = ref.app, BrowserWindow = ref.BrowserWindow;
+var slice = [].slice;
+var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
 
-binding = process.atomBinding('dialog');
-
-v8Util = process.atomBinding('v8_util');
-
-fileDialogProperties = {
+var fileDialogProperties = {
   openFile: 1 << 0,
   openDirectory: 1 << 1,
   multiSelections: 1 << 2,
   createDirectory: 1 << 3
 };
 
-messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'];
+var messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'];
 
-messageBoxOptions = {
+var messageBoxOptions = {
   noLink: 1 << 0
 };
 
-parseArgs = function(window, options, callback) {
+var parseArgs = function(window, options, callback) {
   if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
     // Shift.
     callback = options;
@@ -36,7 +34,7 @@ parseArgs = function(window, options, callback) {
   return [window, options, callback];
 };
 
-checkAppInitialized = function() {
+var checkAppInitialized = function() {
   if (!app.isReady()) {
     throw new Error('dialog module can only be used after app is ready');
   }
@@ -164,8 +162,9 @@ module.exports = {
 };
 
 // Mark standard asynchronous functions.
-ref1 = ['showMessageBox', 'showOpenDialog', 'showSaveDialog'];
+var ref1 = ['showMessageBox', 'showOpenDialog', 'showSaveDialog'];
+var j, len
 for (j = 0, len = ref1.length; j < len; j++) {
-  api = ref1[j];
+  var api = ref1[j];
   v8Util.setHiddenValue(module.exports[api], 'asynchronous', true);
 }
index 74ae751e0834ec556ddf0e9d8bc5d2a300f826b7..7f97fcdbc4cf5653b193785b96ec8af6f7d96773 100644 (file)
@@ -1,6 +1,4 @@
-var common;
-
-common = require('../../../../common/api/lib/exports/electron');
+const common = require('../../../../common/api/lib/exports/electron');
 
 
 // Import common modules.
index bd4300d2c244d0648f26b9717063aa27d4fb935b..e253e03eaabe90330faf94aff67fe64293a5ab85 100644 (file)
@@ -1,5 +1,3 @@
-var EventEmitter;
-
-EventEmitter = require('events').EventEmitter;
+const EventEmitter = require('events').EventEmitter;
 
 module.exports = new EventEmitter;
index ed20e976173f1c0bbf10d46db503fcbb240725fa..6e9715154234fcf109e25abbb52d8fff683cd374 100644 (file)
@@ -1,6 +1,5 @@
-var deprecate, ipcMain, ref;
-
-ref = require('electron'), deprecate = ref.deprecate, ipcMain = ref.ipcMain;
+const deprecate = require('electron').deprecate;
+const ipcMain = require('electron').ipcMain;
 
 // This module is deprecated, we mirror everything from ipcMain.
 deprecate.warn('ipc module', 'require("electron").ipcMain');