docs: fix more tsdoc warnings

* docs: fix most tsdoc warning messages

* docs: i just added spaceline
This commit is contained in:
Ayman Azzam 2021-04-12 15:57:05 +02:00 committed by GitHub
parent e34a6d5318
commit 41f23beb0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 78 additions and 23 deletions

View File

@ -24,7 +24,10 @@ import { Page } from './Page.js';
import { ChildProcess } from 'child_process';
import { Viewport } from './PuppeteerViewport.js';
type BrowserCloseCallback = () => Promise<void> | void;
/**
* @internal
*/
export type BrowserCloseCallback = () => Promise<void> | void;
const WEB_PERMISSION_TO_PROTOCOL_PERMISSION = new Map<
Permission,

View File

@ -23,7 +23,15 @@ import { ProtocolMapping } from 'devtools-protocol/types/protocol-mapping.js';
import { ConnectionTransport } from './ConnectionTransport.js';
import { EventEmitter } from './EventEmitter.js';
interface ConnectionCallback {
/**
* @public
*/
export { ConnectionTransport, ProtocolMapping };
/**
* @public
*/
export interface ConnectionCallback {
resolve: Function;
reject: Function;
error: Error;
@ -67,8 +75,8 @@ export class Connection extends EventEmitter {
}
/**
* @param sessionId -
* @returns {?CDPSession}
* @param sessionId - The session id
* @returns The current CDP session if it exists
*/
session(sessionId: string): CDPSession | null {
return this._sessions.get(sessionId) || null;
@ -167,8 +175,8 @@ export class Connection extends EventEmitter {
}
/**
* @param targetInfo -
* @returns {!Promise<!CDPSession>}
* @param targetInfo - The target info
* @returns The CDP session that is created
*/
async createSession(
targetInfo: Protocol.Target.TargetInfo
@ -181,7 +189,10 @@ export class Connection extends EventEmitter {
}
}
interface CDPSessionOnMessageObject {
/**
* @public
*/
export interface CDPSessionOnMessageObject {
id?: number;
method: string;
params: Record<string, unknown>;

View File

@ -14,6 +14,9 @@
* limitations under the License.
*/
/**
* @public
*/
export interface ConnectionTransport {
send(string);
close();

View File

@ -21,6 +21,11 @@ import { CDPSession } from './Connection.js';
import { EVALUATION_SCRIPT_URL } from './ExecutionContext.js';
/**
* @internal
*/
export { PuppeteerEventListener };
/**
* The CoverageEntry class represents one entry of the coverage report.
* @public
@ -164,7 +169,10 @@ export class Coverage {
}
}
class JSCoverage {
/**
* @public
*/
export class JSCoverage {
_client: CDPSession;
_enabled = false;
_scriptURLs = new Map<string, string>();
@ -277,7 +285,10 @@ class JSCoverage {
}
}
class CSSCoverage {
/**
* @public
*/
export class CSSCoverage {
_client: CDPSession;
_enabled = false;
_stylesheetURLs = new Map<string, string>();

View File

@ -14,7 +14,10 @@
* limitations under the License.
*/
interface Device {
/**
* @public
*/
export interface Device {
name: string;
userAgent: string;
viewport: {
@ -1037,10 +1040,9 @@ export type DevicesMap = {
[name: string]: Device;
};
const devicesMap: DevicesMap = {};
/**
* @internal
*/
export const devicesMap: DevicesMap = {};
for (const device of devices) devicesMap[device.name] = device;
/**
* @public
*/
export { devicesMap };

View File

@ -14,7 +14,10 @@
* limitations under the License.
*/
class CustomError extends Error {
/**
* @public
*/
export class CustomError extends Error {
constructor(message: string) {
super(message);
this.name = this.constructor.name;

View File

@ -4,6 +4,11 @@ import mitt, {
Handler,
} from '../../vendor/mitt/src/index.js';
/**
* @public
*/
export { EventType, Handler };
/**
* @public
*/

View File

@ -35,7 +35,7 @@ const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe |
* frame } has "default" execution context that is always created after frame is
* attached to DOM. This context is returned by the
* {@link frame.executionContext()} method.
* {@link Frame.executionContext} method.
* - {@link https://developer.chrome.com/extensions | Extension}'s content scripts
* create additional execution contexts.
*

View File

@ -34,7 +34,11 @@ export type PuppeteerLifeCycleEvent =
| 'domcontentloaded'
| 'networkidle0'
| 'networkidle2';
type ProtocolLifeCycleEvent =
/**
* @public
*/
export type ProtocolLifeCycleEvent =
| 'load'
| 'DOMContentLoaded'
| 'networkIdle'

View File

@ -130,7 +130,10 @@ export interface GeolocationOptions {
accuracy?: number;
}
interface MediaFeature {
/**
* @public
*/
export interface MediaFeature {
name: string;
value: string;
}
@ -288,7 +291,7 @@ export const enum PageEmittedEvents {
* Emitted when a page issues a request and contains a {@link HTTPRequest}.
*
* @remarks
* The object is readonly. See {@Page.setRequestInterception} for intercepting
* The object is readonly. See {@link Page.setRequestInterception} for intercepting
* and mutating requests.
*/
Request = 'request',
@ -297,7 +300,7 @@ export const enum PageEmittedEvents {
*
* @remarks
* For certain requests, might contain undefined.
* @see https://crbug.com/750469
* {@link https://crbug.com/750469}
*/
RequestServedFromCache = 'requestservedfromcache',
/**

View File

@ -24,7 +24,7 @@ import { EvaluateHandleFn, SerializableOrJSHandle } from './EvalTypes.js';
/**
* @internal
*/
type ConsoleAPICalledCallback = (
export type ConsoleAPICalledCallback = (
eventType: string,
handles: JSHandle[],
trace: Protocol.Runtime.StackTrace
@ -33,7 +33,7 @@ type ConsoleAPICalledCallback = (
/**
* @internal
*/
type ExceptionThrownCallback = (
export type ExceptionThrownCallback = (
details: Protocol.Runtime.ExceptionDetails
) => void;
type JSHandleFactory = (obj: Protocol.Runtime.RemoteObject) => JSHandle;

View File

@ -86,6 +86,9 @@ async function releaseObject(
});
}
/**
* @public
*/
export interface PuppeteerEventListener {
emitter: CommonEventEmitter;
eventName: string | symbol;

View File

@ -1,7 +1,14 @@
/**
* @public
*/
export type EventType = string | symbol;
// An event handler can take an optional event argument
// and should not return a value
/**
* @public
*/
export type Handler<T = any> = (event?: T) => void;
export type WildcardHandler = (type: EventType, event?: any) => void;