Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Mar 29, 2018
1 parent 7608fb7 commit 271e08a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
3 changes: 1 addition & 2 deletions lighthouse-core/gather/connections/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ const log = require('lighthouse-logger');
const LHError = require('../../lib/errors');

/**
* @typedef {{'protocolevent': LH.Protocol.RawEventMessage}} EventMessageRecord
* @typedef {LH.StrictEventEmitter<EventEmitter, EventMessageRecord>} CrdpEventMessageEmitter
* @typedef {LH.StrictEventEmitter<{'protocolevent': LH.Protocol.RawEventMessage}>} CrdpEventMessageEmitter
*/

class Connection {
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/gather/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const DEFAULT_NETWORK_QUIET_THRESHOLD = 5000;
const DEFAULT_CPU_QUIET_THRESHOLD = 0;

/**
* @typedef {LH.StrictEventEmitter<EventEmitter, LH.CrdpEvents>} CrdpEventEmitter
* @typedef {LH.StrictEventEmitter<LH.CrdpEvents>} CrdpEventEmitter
*/

class Driver {
Expand Down Expand Up @@ -1187,7 +1187,7 @@ Driver.prototype.on = function on(eventName, cb) {
/**
* Bind a one-time listener for protocol events. Listener is removed once it
* has been called.
* @type {CrdpEventEmitter['on']}
* @type {CrdpEventEmitter['once']}
*/
Driver.prototype.once = function once(eventName, cb) {
if (this._eventEmitter === null) {
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/scripts/extract-crdp-mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const fs = require('fs');
const path = require('path');
const ts = require('typescript');

const crdpTypingFile = './node_modules/vscode-chrome-debug-core/lib/crdp/crdp.d.ts';
const lhCrdpExternsFile = path.resolve(__dirname, '../../typings/crdp-mapping.d.ts');
const crdpTypingFile = require.resolve('vscode-chrome-debug-core/lib/crdp/crdp.d.ts');
const lhCrdpExternsOutputFile = path.resolve(__dirname, '../../typings/crdp-mapping.d.ts');

/* eslint-disable max-len */
const headerBlock = `/**
Expand Down Expand Up @@ -189,4 +189,4 @@ export {}

// eslint-disable-next-line no-console
console.log('crdp mappings generated');
fs.writeFileSync(lhCrdpExternsFile, crdpStr);
fs.writeFileSync(lhCrdpExternsOutputFile, crdpStr);
5 changes: 3 additions & 2 deletions typings/externs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

import _Crdp from "../node_modules/vscode-chrome-debug-core/lib/crdp/crdp";
import _Crdp from '../node_modules/vscode-chrome-debug-core/lib/crdp/crdp';
import _StrictEventEmitter from '../third-party/strict-event-emitter-types/index';
import { EventEmitter } from 'events';

declare global {
module LH {
// re-export useful type modules under global LH module.
export import Crdp = _Crdp;
export type StrictEventEmitter<TEmitterType, TEventRecord, TEmitRecord = TEventRecord> =
export type StrictEventEmitter<TEventRecord, TEmitterType = EventEmitter, TEmitRecord = TEventRecord> =
_StrictEventEmitter<TEmitterType, TEventRecord, TEmitRecord>;

interface SharedFlagsSettings {
Expand Down

0 comments on commit 271e08a

Please sign in to comment.