Use const

This commit is contained in:
Jessica Lord 2016-01-14 14:11:50 -08:00
parent 1779701445
commit ab8908a4af
7 changed files with 29 additions and 49 deletions

View file

@ -1,12 +1,7 @@
var Module, fs, path, timers, wrapWithActivateUvLoop; const fs = require('fs');
const path = require('path');
fs = require('fs'); const timers = require('timers');
const Module = require('module');
path = require('path');
timers = require('timers');
Module = require('module');
process.atomBinding = function(name) { process.atomBinding = function(name) {
var e, error; var e, error;
@ -32,7 +27,7 @@ if (!process.env.ELECTRON_HIDE_INTERNAL_MODULES) {
// which would delay the callbacks for arbitrary long time. So we should // which would delay the callbacks for arbitrary long time. So we should
// initiatively activate the uv loop once setImmediate and process.nextTick is // initiatively activate the uv loop once setImmediate and process.nextTick is
// called. // called.
wrapWithActivateUvLoop = function(func) { var wrapWithActivateUvLoop = function(func) {
return function() { return function() {
process.activateUvLoop(); process.activateUvLoop();
return func.apply(this, arguments); return func.apply(this, arguments);

View file

@ -1,8 +1,5 @@
var Module, path; const path = require('path');
const Module = require('module');
path = require('path');
Module = require('module');
// Clear Node's global search paths. // Clear Node's global search paths.
Module.globalPaths.length = 0; Module.globalPaths.length = 0;

View file

@ -1,16 +1,15 @@
var getNextId, ipcRenderer, isValid, nativeImage, nextId, ref, const ipcRenderer = require('electron').ipcRenderer;
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 nativeImage = require('electron').ref.nativeImage;
ref = require('electron'), ipcRenderer = ref.ipcRenderer, nativeImage = ref.nativeImage; var nextId = 0;
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; };
nextId = 0; var getNextId = function() {
getNextId = function() {
return ++nextId; return ++nextId;
}; };
// |options.type| can not be empty and has to include 'window' or 'screen'. // |options.type| can not be empty and has to include 'window' or 'screen'.
isValid = function(options) { var isValid = function(options) {
return ((options != null ? options.types : void 0) != null) && Array.isArray(options.types); return ((options != null ? options.types : void 0) != null) && Array.isArray(options.types);
}; };

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.
common.defineProperties(exports); common.defineProperties(exports);

View file

@ -1,14 +1,11 @@
var EventEmitter, binding, ipcRenderer, v8Util, const EventEmitter = require('events').EventEmitter;
slice = [].slice; const binding = process.atomBinding('ipc');
const v8Util = process.atomBinding('v8_util');
EventEmitter = require('events').EventEmitter; var slice = [].slice;
binding = process.atomBinding('ipc');
v8Util = process.atomBinding('v8_util');
// Created by init.coffee. // Created by init.coffee.
ipcRenderer = v8Util.getHiddenValue(global, 'ipc'); const ipcRenderer = v8Util.getHiddenValue(global, 'ipc');
ipcRenderer.send = function() { ipcRenderer.send = function() {
var args; var args;

View file

@ -1,8 +1,5 @@
var chrome, url; const url = require('url');
const chrome = window.chrome = window.chrome || {};
url = require('url');
chrome = window.chrome = window.chrome || {};
chrome.extension = { chrome.extension = {
getURL: function(path) { getURL: function(path) {

View file

@ -1,5 +1,3 @@
var convertToMenuTemplate, createFileSelectorElement, createMenu, pathToHtml5FileObject, showFileChooserDialog;
window.onload = function() { window.onload = function() {
// Use menu API to show context menu. // Use menu API to show context menu.
InspectorFrontendHost.showContextMenuAtPoint = createMenu; InspectorFrontendHost.showContextMenuAtPoint = createMenu;
@ -8,7 +6,7 @@ window.onload = function() {
return WebInspector.createFileSelectorElement = createFileSelectorElement; return WebInspector.createFileSelectorElement = createFileSelectorElement;
}; };
convertToMenuTemplate = function(items) { var convertToMenuTemplate = function(items) {
var fn, i, item, len, template; var fn, i, item, len, template;
template = []; template = [];
fn = function(item) { fn = function(item) {
@ -45,11 +43,10 @@ convertToMenuTemplate = function(items) {
return template; return template;
}; };
createMenu = function(x, y, items, document) { var createMenu = function(x, y, items, document) {
var Menu, menu, remote; const remote = require('electron').remote;
remote = require('electron').remote; const Menu = remote.Menu;
Menu = remote.Menu; const menu = Menu.buildFromTemplate(convertToMenuTemplate(items));
menu = Menu.buildFromTemplate(convertToMenuTemplate(items));
// The menu is expected to show asynchronously. // The menu is expected to show asynchronously.
return setTimeout(function() { return setTimeout(function() {
@ -57,7 +54,7 @@ createMenu = function(x, y, items, document) {
}); });
}; };
showFileChooserDialog = function(callback) { var showFileChooserDialog = function(callback) {
var dialog, files, remote; var dialog, files, remote;
remote = require('electron').remote; remote = require('electron').remote;
dialog = remote.dialog; dialog = remote.dialog;
@ -67,7 +64,7 @@ showFileChooserDialog = function(callback) {
} }
}; };
pathToHtml5FileObject = function(path) { var pathToHtml5FileObject = function(path) {
var blob, fs; var blob, fs;
fs = require('fs'); fs = require('fs');
blob = new Blob([fs.readFileSync(path)]); blob = new Blob([fs.readFileSync(path)]);
@ -75,7 +72,7 @@ pathToHtml5FileObject = function(path) {
return blob; return blob;
}; };
createFileSelectorElement = function(callback) { var createFileSelectorElement = function(callback) {
var fileSelectorElement; var fileSelectorElement;
fileSelectorElement = document.createElement('span'); fileSelectorElement = document.createElement('span');
fileSelectorElement.style.display = 'none'; fileSelectorElement.style.display = 'none';