Use const a lot fo places (#188)

This commit is contained in:
JoelEinbinder 2017-08-02 12:06:47 -07:00 committed by GitHub
parent bd72e40e73
commit 5d647bf1fa
17 changed files with 106 additions and 106 deletions

View File

@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
let Downloader = require('./utils/ChromiumDownloader'); const Downloader = require('./utils/ChromiumDownloader');
let revision = require('./package').puppeteer.chromium_revision; const revision = require('./package').puppeteer.chromium_revision;
let ProgressBar = require('progress'); const ProgressBar = require('progress');
// Do nothing if the revision is already downloaded. // Do nothing if the revision is already downloaded.
if (Downloader.revisionInfo(Downloader.currentPlatform(), revision)) if (Downloader.revisionInfo(Downloader.currentPlatform(), revision))

View File

@ -14,20 +14,20 @@
* limitations under the License. * limitations under the License.
*/ */
let {Duplex} = require('stream'); const {Duplex} = require('stream');
let path = require('path'); const path = require('path');
let helper = require('./helper'); const helper = require('./helper');
let removeRecursive = require('rimraf').sync; const removeRecursive = require('rimraf').sync;
let Page = require('./Page'); const Page = require('./Page');
let childProcess = require('child_process'); const childProcess = require('child_process');
let Downloader = require('../utils/ChromiumDownloader'); const Downloader = require('../utils/ChromiumDownloader');
let Connection = require('./Connection'); const Connection = require('./Connection');
let readline = require('readline'); const readline = require('readline');
let CHROME_PROFILE_PATH = path.resolve(__dirname, '..', '.dev_profile'); const CHROME_PROFILE_PATH = path.resolve(__dirname, '..', '.dev_profile');
let browserId = 0; let browserId = 0;
let DEFAULT_ARGS = [ const DEFAULT_ARGS = [
'--disable-background-networking', '--disable-background-networking',
'--disable-background-timer-throttling', '--disable-background-timer-throttling',
'--disable-client-side-phishing-detection', '--disable-client-side-phishing-detection',

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
let debug = require('debug')('puppeteer:protocol'); const debug = require('debug')('puppeteer:protocol');
let EventEmitter = require('events'); const EventEmitter = require('events');
let WebSocket = require('ws'); const WebSocket = require('ws');
let http = require('http'); const http = require('http');
const COMMAND_TIMEOUT = 10000; const COMMAND_TIMEOUT = 10000;
class Connection extends EventEmitter { class Connection extends EventEmitter {

View File

@ -14,10 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
let fs = require('fs'); const fs = require('fs');
let path = require('path'); const path = require('path');
let EventEmitter = require('events'); const EventEmitter = require('events');
let helper = require('./helper'); const helper = require('./helper');
class FrameManager extends EventEmitter { class FrameManager extends EventEmitter {
/** /**

View File

@ -14,17 +14,17 @@
* limitations under the License. * limitations under the License.
*/ */
let fs = require('fs'); const fs = require('fs');
let EventEmitter = require('events'); const EventEmitter = require('events');
let mime = require('mime'); const mime = require('mime');
let NetworkManager = require('./NetworkManager'); const NetworkManager = require('./NetworkManager');
let NavigatorWatcher = require('./NavigatorWatcher'); const NavigatorWatcher = require('./NavigatorWatcher');
let Dialog = require('./Dialog'); const Dialog = require('./Dialog');
let EmulationManager = require('./EmulationManager'); const EmulationManager = require('./EmulationManager');
let FrameManager = require('./FrameManager'); const FrameManager = require('./FrameManager');
let {Keyboard, Mouse} = require('./Input'); const {Keyboard, Mouse} = require('./Input');
let Tracing = require('./Tracing'); const Tracing = require('./Tracing');
let helper = require('./helper'); const helper = require('./helper');
class Page extends EventEmitter { class Page extends EventEmitter {
/** /**

View File

@ -14,11 +14,11 @@
* limitations under the License. * limitations under the License.
*/ */
let path = require('path'); const path = require('path');
let fs = require('fs'); const fs = require('fs');
let deasync = require('deasync'); const deasync = require('deasync');
let removeRecursive = require('rimraf').sync; const removeRecursive = require('rimraf').sync;
let copyRecursive = deasync(require('ncp').ncp); const copyRecursive = deasync(require('ncp').ncp);
class FileSystem { class FileSystem {
constructor() { constructor() {

View File

@ -14,10 +14,10 @@
* limitations under the License. * limitations under the License.
*/ */
let fs = require('fs'); const fs = require('fs');
let path = require('path'); const path = require('path');
let vm = require('vm'); const vm = require('vm');
let url = require('url'); const url = require('url');
const VERSION = [0, 0, 1]; const VERSION = [0, 0, 1];

View File

@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
let readline = require('readline'); const readline = require('readline');
let await = require('./utilities').await; const await = require('./utilities').await;
let os = require('os'); const os = require('os');
class System { class System {
/** /**

View File

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
let await = require('./utilities').await; const await = require('./utilities').await;
let EventEmitter = require('events'); const EventEmitter = require('events');
let fs = require('fs'); const fs = require('fs');
let path = require('path'); const path = require('path');
let PageEvents = require('../lib/Page').Events; const PageEvents = require('../lib/Page').Events;
let noop = function() { }; const noop = function() { };
class WebPage { class WebPage {
/** /**

View File

@ -14,8 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
let http = require('http'); const http = require('http');
let await = require('./utilities').await; const await = require('./utilities').await;
class WebServer { class WebServer {
constructor() { constructor() {

View File

@ -15,17 +15,17 @@
* limitations under the License. * limitations under the License.
*/ */
let vm = require('vm'); const vm = require('vm');
let path = require('path'); const path = require('path');
let fs = require('fs'); const fs = require('fs');
let Phantom = require('./Phantom'); const Phantom = require('./Phantom');
let FileSystem = require('./FileSystem'); const FileSystem = require('./FileSystem');
let System = require('./System'); const System = require('./System');
let WebPage = require('./WebPage'); const WebPage = require('./WebPage');
let WebServer = require('./WebServer'); const WebServer = require('./WebServer');
let child_process = require('child_process'); const child_process = require('child_process');
let Browser = require('..').Browser; const Browser = require('..').Browser;
let argv = require('minimist')(process.argv.slice(2), { const argv = require('minimist')(process.argv.slice(2), {
alias: { v: 'version' }, alias: { v: 'version' },
boolean: ['headless'], boolean: ['headless'],
default: {'headless': true }, default: {'headless': true },

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
let loopWhile = require('deasync').loopWhile; const loopWhile = require('deasync').loopWhile;
module.exports = { module.exports = {
await: function(promise) { await: function(promise) {

View File

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
let path = require('path'); const path = require('path');
let fs = require('fs'); const fs = require('fs');
let Diff = require('text-diff'); const Diff = require('text-diff');
let mime = require('mime'); const mime = require('mime');
let PNG = require('pngjs').PNG; const PNG = require('pngjs').PNG;
let pixelmatch = require('pixelmatch'); const pixelmatch = require('pixelmatch');
module.exports = { module.exports = {
addMatchers: function(jasmine, goldenPath, outputPath) { addMatchers: function(jasmine, goldenPath, outputPath) {

View File

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
let http = require('http'); const http = require('http');
let https = require('https'); const https = require('https');
let url = require('url'); const url = require('url');
let fs = require('fs'); const fs = require('fs');
let path = require('path'); const path = require('path');
let mime = require('mime'); const mime = require('mime');
let WebSocketServer = require('ws').Server; const WebSocketServer = require('ws').Server;
const fulfillSymbol = Symbol('fullfill callback'); const fulfillSymbol = Symbol('fullfill callback');
const rejectSymbol = Symbol('reject callback'); const rejectSymbol = Symbol('reject callback');

View File

@ -14,24 +14,24 @@
* limitations under the License. * limitations under the License.
*/ */
let fs = require('fs'); const fs = require('fs');
let rm = require('rimraf').sync; const rm = require('rimraf').sync;
let path = require('path'); const path = require('path');
let helper = require('../lib/helper'); const helper = require('../lib/helper');
if (process.env.COVERAGE) if (process.env.COVERAGE)
helper.recordPublicAPICoverage(); helper.recordPublicAPICoverage();
let Browser = require('../lib/Browser'); const Browser = require('../lib/Browser');
let SimpleServer = require('./server/SimpleServer'); const SimpleServer = require('./server/SimpleServer');
let GoldenUtils = require('./golden-utils'); const GoldenUtils = require('./golden-utils');
let GOLDEN_DIR = path.join(__dirname, 'golden'); const GOLDEN_DIR = path.join(__dirname, 'golden');
let OUTPUT_DIR = path.join(__dirname, 'output'); const OUTPUT_DIR = path.join(__dirname, 'output');
let PORT = 8907; const PORT = 8907;
let PREFIX = 'http://localhost:' + PORT; const PREFIX = 'http://localhost:' + PORT;
let EMPTY_PAGE = PREFIX + '/empty.html'; const EMPTY_PAGE = PREFIX + '/empty.html';
let HTTPS_PORT = 8908; const HTTPS_PORT = 8908;
let HTTPS_PREFIX = 'https://localhost:' + HTTPS_PORT; const HTTPS_PREFIX = 'https://localhost:' + HTTPS_PORT;
const iPhone = require('../DeviceDescriptors')['iPhone 6']; const iPhone = require('../DeviceDescriptors')['iPhone 6'];
const iPhoneLandscape = require('../DeviceDescriptors')['iPhone 6 landscape']; const iPhoneLandscape = require('../DeviceDescriptors')['iPhone 6 landscape'];

View File

@ -14,18 +14,18 @@
* limitations under the License. * limitations under the License.
*/ */
let os = require('os'); const os = require('os');
let https = require('https'); const https = require('https');
let fs = require('fs'); const fs = require('fs');
let path = require('path'); const path = require('path');
let extract = require('extract-zip'); const extract = require('extract-zip');
let util = require('util'); const util = require('util');
let URL = require('url'); const URL = require('url');
let removeRecursive = require('rimraf'); const removeRecursive = require('rimraf');
let DOWNLOADS_FOLDER = path.join(__dirname, '..', '.local-chromium'); const DOWNLOADS_FOLDER = path.join(__dirname, '..', '.local-chromium');
let downloadURLs = { const downloadURLs = {
linux: 'https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/%d/chrome-linux.zip', linux: 'https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/%d/chrome-linux.zip',
mac: 'https://storage.googleapis.com/chromium-browser-snapshots/Mac/%d/chrome-mac.zip', mac: 'https://storage.googleapis.com/chromium-browser-snapshots/Mac/%d/chrome-mac.zip',
win32: 'https://storage.googleapis.com/chromium-browser-snapshots/Win/%d/chrome-win32.zip', win32: 'https://storage.googleapis.com/chromium-browser-snapshots/Win/%d/chrome-win32.zip',

View File

@ -15,11 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
let Downloader = require('./ChromiumDownloader'); const Downloader = require('./ChromiumDownloader');
let https = require('https'); const https = require('https');
let OMAHA_PROXY = 'https://omahaproxy.appspot.com/all.json'; const OMAHA_PROXY = 'https://omahaproxy.appspot.com/all.json';
let colors = { const colors = {
reset: '\x1b[0m', reset: '\x1b[0m',
red: '\x1b[31m', red: '\x1b[31m',
green: '\x1b[32m', green: '\x1b[32m',