Use const a lot fo places (#188)
This commit is contained in:
parent
bd72e40e73
commit
5d647bf1fa
@ -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))
|
||||
|
@ -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');
|
||||
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');
|
||||
|
||||
let CHROME_PROFILE_PATH = path.resolve(__dirname, '..', '.dev_profile');
|
||||
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',
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
/**
|
||||
|
22
lib/Page.js
22
lib/Page.js
@ -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 {
|
||||
/**
|
||||
|
@ -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() {
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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 {
|
||||
/**
|
||||
|
@ -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 {
|
||||
/**
|
||||
|
@ -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() {
|
||||
|
@ -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 },
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let loopWhile = require('deasync').loopWhile;
|
||||
const loopWhile = require('deasync').loopWhile;
|
||||
|
||||
module.exports = {
|
||||
await: function(promise) {
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
28
test/test.js
28
test/test.js
@ -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');
|
||||
const Browser = require('../lib/Browser');
|
||||
const SimpleServer = require('./server/SimpleServer');
|
||||
const GoldenUtils = require('./golden-utils');
|
||||
|
||||
let GOLDEN_DIR = path.join(__dirname, 'golden');
|
||||
let OUTPUT_DIR = path.join(__dirname, 'output');
|
||||
const GOLDEN_DIR = path.join(__dirname, 'golden');
|
||||
const 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 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'];
|
||||
|
@ -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',
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user