Skip to content

Commit

Permalink
Use const a lot fo places (puppeteer#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelEinbinder authored Aug 2, 2017
1 parent bd72e40 commit 5d647bf
Show file tree
Hide file tree
Showing 17 changed files with 109 additions and 109 deletions.
6 changes: 3 additions & 3 deletions install.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

let Downloader = require('./utils/ChromiumDownloader');
let revision = require('./package').puppeteer.chromium_revision;
let ProgressBar = require('progress');
const Downloader = require('./utils/ChromiumDownloader');
const revision = require('./package').puppeteer.chromium_revision;
const ProgressBar = require('progress');

// Do nothing if the revision is already downloaded.
if (Downloader.revisionInfo(Downloader.currentPlatform(), revision))
Expand Down
24 changes: 12 additions & 12 deletions lib/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
* limitations under the License.
*/

let {Duplex} = require('stream');
let path = require('path');
let helper = require('./helper');
let removeRecursive = require('rimraf').sync;
let Page = require('./Page');
let childProcess = require('child_process');
let Downloader = require('../utils/ChromiumDownloader');
let Connection = require('./Connection');
let readline = require('readline');

let CHROME_PROFILE_PATH = path.resolve(__dirname, '..', '.dev_profile');
const {Duplex} = require('stream');
const path = require('path');
const helper = require('./helper');
const removeRecursive = require('rimraf').sync;
const Page = require('./Page');
const childProcess = require('child_process');
const Downloader = require('../utils/ChromiumDownloader');
const Connection = require('./Connection');
const readline = require('readline');

const CHROME_PROFILE_PATH = path.resolve(__dirname, '..', '.dev_profile');
let browserId = 0;

let DEFAULT_ARGS = [
const DEFAULT_ARGS = [
'--disable-background-networking',
'--disable-background-timer-throttling',
'--disable-client-side-phishing-detection',
Expand Down
8 changes: 4 additions & 4 deletions lib/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
let debug = require('debug')('puppeteer:protocol');
const debug = require('debug')('puppeteer:protocol');

let EventEmitter = require('events');
let WebSocket = require('ws');
let http = require('http');
const EventEmitter = require('events');
const WebSocket = require('ws');
const http = require('http');
const COMMAND_TIMEOUT = 10000;

class Connection extends EventEmitter {
Expand Down
8 changes: 4 additions & 4 deletions lib/FrameManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

let fs = require('fs');
let path = require('path');
let EventEmitter = require('events');
let helper = require('./helper');
const fs = require('fs');
const path = require('path');
const EventEmitter = require('events');
const helper = require('./helper');

class FrameManager extends EventEmitter {
/**
Expand Down
22 changes: 11 additions & 11 deletions lib/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
* limitations under the License.
*/

let fs = require('fs');
let EventEmitter = require('events');
let mime = require('mime');
let NetworkManager = require('./NetworkManager');
let NavigatorWatcher = require('./NavigatorWatcher');
let Dialog = require('./Dialog');
let EmulationManager = require('./EmulationManager');
let FrameManager = require('./FrameManager');
let {Keyboard, Mouse} = require('./Input');
let Tracing = require('./Tracing');
let helper = require('./helper');
const fs = require('fs');
const EventEmitter = require('events');
const mime = require('mime');
const NetworkManager = require('./NetworkManager');
const NavigatorWatcher = require('./NavigatorWatcher');
const Dialog = require('./Dialog');
const EmulationManager = require('./EmulationManager');
const FrameManager = require('./FrameManager');
const {Keyboard, Mouse} = require('./Input');
const Tracing = require('./Tracing');
const helper = require('./helper');

class Page extends EventEmitter {
/**
Expand Down
10 changes: 5 additions & 5 deletions phantom_shim/FileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

let path = require('path');
let fs = require('fs');
let deasync = require('deasync');
let removeRecursive = require('rimraf').sync;
let copyRecursive = deasync(require('ncp').ncp);
const path = require('path');
const fs = require('fs');
const deasync = require('deasync');
const removeRecursive = require('rimraf').sync;
const copyRecursive = deasync(require('ncp').ncp);

class FileSystem {
constructor() {
Expand Down
8 changes: 4 additions & 4 deletions phantom_shim/Phantom.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

let fs = require('fs');
let path = require('path');
let vm = require('vm');
let url = require('url');
const fs = require('fs');
const path = require('path');
const vm = require('vm');
const url = require('url');

const VERSION = [0, 0, 1];

Expand Down
6 changes: 3 additions & 3 deletions phantom_shim/System.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

let readline = require('readline');
let await = require('./utilities').await;
let os = require('os');
const readline = require('readline');
const await = require('./utilities').await;
const os = require('os');

class System {
/**
Expand Down
12 changes: 6 additions & 6 deletions phantom_shim/WebPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

let await = require('./utilities').await;
let EventEmitter = require('events');
let fs = require('fs');
let path = require('path');
let PageEvents = require('../lib/Page').Events;
const await = require('./utilities').await;
const EventEmitter = require('events');
const fs = require('fs');
const path = require('path');
const PageEvents = require('../lib/Page').Events;

let noop = function() { };
const noop = function() { };

class WebPage {
/**
Expand Down
4 changes: 2 additions & 2 deletions phantom_shim/WebServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

let http = require('http');
let await = require('./utilities').await;
const http = require('http');
const await = require('./utilities').await;

class WebServer {
constructor() {
Expand Down
22 changes: 11 additions & 11 deletions phantom_shim/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
* limitations under the License.
*/

let vm = require('vm');
let path = require('path');
let fs = require('fs');
let Phantom = require('./Phantom');
let FileSystem = require('./FileSystem');
let System = require('./System');
let WebPage = require('./WebPage');
let WebServer = require('./WebServer');
let child_process = require('child_process');
let Browser = require('..').Browser;
let argv = require('minimist')(process.argv.slice(2), {
const vm = require('vm');
const path = require('path');
const fs = require('fs');
const Phantom = require('./Phantom');
const FileSystem = require('./FileSystem');
const System = require('./System');
const WebPage = require('./WebPage');
const WebServer = require('./WebServer');
const child_process = require('child_process');
const Browser = require('..').Browser;
const argv = require('minimist')(process.argv.slice(2), {
alias: { v: 'version' },
boolean: ['headless'],
default: {'headless': true },
Expand Down
2 changes: 1 addition & 1 deletion phantom_shim/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

let loopWhile = require('deasync').loopWhile;
const loopWhile = require('deasync').loopWhile;

module.exports = {
await: function(promise) {
Expand Down
12 changes: 6 additions & 6 deletions test/golden-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
let path = require('path');
let fs = require('fs');
let Diff = require('text-diff');
let mime = require('mime');
let PNG = require('pngjs').PNG;
let pixelmatch = require('pixelmatch');
const path = require('path');
const fs = require('fs');
const Diff = require('text-diff');
const mime = require('mime');
const PNG = require('pngjs').PNG;
const pixelmatch = require('pixelmatch');

module.exports = {
addMatchers: function(jasmine, goldenPath, outputPath) {
Expand Down
14 changes: 7 additions & 7 deletions test/server/SimpleServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
* limitations under the License.
*/

let http = require('http');
let https = require('https');
let url = require('url');
let fs = require('fs');
let path = require('path');
let mime = require('mime');
let WebSocketServer = require('ws').Server;
const http = require('http');
const https = require('https');
const url = require('url');
const fs = require('fs');
const path = require('path');
const mime = require('mime');
const WebSocketServer = require('ws').Server;

const fulfillSymbol = Symbol('fullfill callback');
const rejectSymbol = Symbol('reject callback');
Expand Down
32 changes: 16 additions & 16 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
* limitations under the License.
*/

let fs = require('fs');
let rm = require('rimraf').sync;
let path = require('path');
let helper = require('../lib/helper');
const fs = require('fs');
const rm = require('rimraf').sync;
const path = require('path');
const helper = require('../lib/helper');
if (process.env.COVERAGE)
helper.recordPublicAPICoverage();
let Browser = require('../lib/Browser');
let SimpleServer = require('./server/SimpleServer');
let GoldenUtils = require('./golden-utils');

let GOLDEN_DIR = path.join(__dirname, 'golden');
let OUTPUT_DIR = path.join(__dirname, 'output');

let PORT = 8907;
let PREFIX = 'http://localhost:' + PORT;
let EMPTY_PAGE = PREFIX + '/empty.html';
let HTTPS_PORT = 8908;
let HTTPS_PREFIX = 'https://localhost:' + HTTPS_PORT;
const Browser = require('../lib/Browser');
const SimpleServer = require('./server/SimpleServer');
const GoldenUtils = require('./golden-utils');

const GOLDEN_DIR = path.join(__dirname, 'golden');
const OUTPUT_DIR = path.join(__dirname, 'output');

const PORT = 8907;
const PREFIX = 'http://localhost:' + PORT;
const EMPTY_PAGE = PREFIX + '/empty.html';
const HTTPS_PORT = 8908;
const HTTPS_PREFIX = 'https://localhost:' + HTTPS_PORT;

const iPhone = require('../DeviceDescriptors')['iPhone 6'];
const iPhoneLandscape = require('../DeviceDescriptors')['iPhone 6 landscape'];
Expand Down
20 changes: 10 additions & 10 deletions utils/ChromiumDownloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* limitations under the License.
*/

let os = require('os');
let https = require('https');
let fs = require('fs');
let path = require('path');
let extract = require('extract-zip');
let util = require('util');
let URL = require('url');
let removeRecursive = require('rimraf');
const os = require('os');
const https = require('https');
const fs = require('fs');
const path = require('path');
const extract = require('extract-zip');
const util = require('util');
const URL = require('url');
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',
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',
Expand Down
8 changes: 4 additions & 4 deletions utils/check_availability.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

let Downloader = require('./ChromiumDownloader');
let https = require('https');
let OMAHA_PROXY = 'https://omahaproxy.appspot.com/all.json';
const Downloader = require('./ChromiumDownloader');
const https = require('https');
const OMAHA_PROXY = 'https://omahaproxy.appspot.com/all.json';

let colors = {
const colors = {
reset: '\x1b[0m',
red: '\x1b[31m',
green: '\x1b[32m',
Expand Down

0 comments on commit 5d647bf

Please sign in to comment.