Use const

This commit is contained in:
Jessica Lord 2016-01-14 13:16:42 -08:00
parent f31289c735
commit 9103253f62
10 changed files with 55 additions and 72 deletions

View file

@ -1,15 +1,21 @@
var EventEmitter, Menu, app, appPath, bindings, deprecate, downloadItemBindings, fn, i, len, name, ref, ref1, session, wrapDownloadItem, const deprecate = require('electron').deprecate;
slice = [].slice; const session = require('electron').session;
const Menu = require('electron').Menu;
const EventEmitter = require('events').EventEmitter;
ref = require('electron'), deprecate = ref.deprecate, session = ref.session, Menu = ref.Menu; const bindings = process.atomBinding('app');
const downloadItemBindings = process.atomBinding('download_item');
const app = bindings.app;
EventEmitter = require('events').EventEmitter; var slice = [].slice;
bindings = process.atomBinding('app'); var appPath;
var fn;
downloadItemBindings = process.atomBinding('download_item'); var i;
var len;
app = bindings.app; var name;
var ref1;
var wrapDownloadItem;
app.__proto__ = EventEmitter.prototype; app.__proto__ = EventEmitter.prototype;

View file

@ -1,8 +1,5 @@
var autoUpdater, deprecate; const deprecate = require('electron').deprecate;
const autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
deprecate = require('electron').deprecate;
autoUpdater = process.platform === 'win32' ? require('./auto-updater/auto-updater-win') : require('./auto-updater/auto-updater-native');
// Deprecated. // Deprecated.
deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL'); deprecate.rename(autoUpdater, 'setFeedUrl', 'setFeedURL');

View file

@ -1,8 +1,5 @@
var EventEmitter, autoUpdater; const EventEmitter = require('events').EventEmitter;
const autoUpdater = process.atomBinding('auto_updater').autoUpdater;
EventEmitter = require('events').EventEmitter;
autoUpdater = process.atomBinding('auto_updater').autoUpdater;
autoUpdater.__proto__ = EventEmitter.prototype; autoUpdater.__proto__ = EventEmitter.prototype;

View file

@ -1,16 +1,12 @@
var AutoUpdater, EventEmitter, app, squirrelUpdate, url, const app = require('electron').app;
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; }, const EventEmitter = require('events').EventEmitter;
hasProp = {}.hasOwnProperty; 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; var AutoUpdater = (function(superClass) {
url = require('url');
squirrelUpdate = require('./squirrel-update-win');
AutoUpdater = (function(superClass) {
extend(AutoUpdater, superClass); extend(AutoUpdater, superClass);
function AutoUpdater() { function AutoUpdater() {

View file

@ -1,22 +1,18 @@
var appFolder, exeName, fs, path, spawn, spawnUpdate, updateExe; const fs = require('fs');
const path = require('path');
fs = require('fs'); const spawn = require('child_process').spawn;
path = require('path');
spawn = require('child_process').spawn;
// i.e. my-app/app-0.1.13/ // 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 // 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 // Spawn a command and invoke the callback when it completes with an error
// and the output from standard out. // and the output from standard out.
spawnUpdate = function(args, detached, callback) { var spawnUpdate = function(args, detached, callback) {
var error, error1, errorEmitted, spawnedProcess, stderr, stdout; var error, error1, errorEmitted, spawnedProcess, stderr, stdout;
try { try {
spawnedProcess = spawn(updateExe, args, { spawnedProcess = spawn(updateExe, args, {

View file

@ -1,10 +1,7 @@
var BrowserWindow, EventEmitter, deprecate, ipcMain, ref; const ipcMain = require('electron').ipcMain;
const deprecate = require('electron').deprecate;
ref = require('electron'), ipcMain = ref.ipcMain, deprecate = ref.deprecate; const EventEmitter = require('events').EventEmitter;
const BrowserWindow = process.atomBinding('window').BrowserWindow;
EventEmitter = require('events').EventEmitter;
BrowserWindow = process.atomBinding('window').BrowserWindow;
BrowserWindow.prototype.__proto__ = EventEmitter.prototype; BrowserWindow.prototype.__proto__ = EventEmitter.prototype;

View file

@ -1,27 +1,25 @@
var BrowserWindow, api, app, binding, checkAppInitialized, fileDialogProperties, j, len, messageBoxOptions, messageBoxTypes, parseArgs, ref, ref1, v8Util, const app = require('electron').app;
slice = [].slice, const BrowserWindow = require('electron').BrowserWindow;
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 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'); var fileDialogProperties = {
v8Util = process.atomBinding('v8_util');
fileDialogProperties = {
openFile: 1 << 0, openFile: 1 << 0,
openDirectory: 1 << 1, openDirectory: 1 << 1,
multiSelections: 1 << 2, multiSelections: 1 << 2,
createDirectory: 1 << 3 createDirectory: 1 << 3
}; };
messageBoxTypes = ['none', 'info', 'warning', 'error', 'question']; var messageBoxTypes = ['none', 'info', 'warning', 'error', 'question'];
messageBoxOptions = { var messageBoxOptions = {
noLink: 1 << 0 noLink: 1 << 0
}; };
parseArgs = function(window, options, callback) { var parseArgs = function(window, options, callback) {
if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) { if (!(window === null || (window != null ? window.constructor : void 0) === BrowserWindow)) {
// Shift. // Shift.
callback = options; callback = options;
@ -36,7 +34,7 @@ parseArgs = function(window, options, callback) {
return [window, options, callback]; return [window, options, callback];
}; };
checkAppInitialized = function() { var checkAppInitialized = function() {
if (!app.isReady()) { if (!app.isReady()) {
throw new Error('dialog module can only be used after app is ready'); throw new Error('dialog module can only be used after app is ready');
} }
@ -164,8 +162,9 @@ module.exports = {
}; };
// Mark standard asynchronous functions. // 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++) { for (j = 0, len = ref1.length; j < len; j++) {
api = ref1[j]; var api = ref1[j];
v8Util.setHiddenValue(module.exports[api], 'asynchronous', true); v8Util.setHiddenValue(module.exports[api], 'asynchronous', true);
} }

View file

@ -1,6 +1,4 @@
var common; const common = require('../../../../common/api/lib/exports/electron');
common = require('../../../../common/api/lib/exports/electron');
// Import common modules. // Import common modules.

View file

@ -1,5 +1,3 @@
var EventEmitter; const EventEmitter = require('events').EventEmitter;
EventEmitter = require('events').EventEmitter;
module.exports = new EventEmitter; module.exports = new EventEmitter;

View file

@ -1,6 +1,5 @@
var deprecate, ipcMain, ref; const deprecate = require('electron').deprecate;
const ipcMain = require('electron').ipcMain;
ref = require('electron'), deprecate = ref.deprecate, ipcMain = ref.ipcMain;
// This module is deprecated, we mirror everything from ipcMain. // This module is deprecated, we mirror everything from ipcMain.
deprecate.warn('ipc module', 'require("electron").ipcMain'); deprecate.warn('ipc module', 'require("electron").ipcMain');