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 { ChildProcess } from 'child_process';
import { Viewport } from './PuppeteerViewport.js'; 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< const WEB_PERMISSION_TO_PROTOCOL_PERMISSION = new Map<
Permission, Permission,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,11 @@ import mitt, {
Handler, Handler,
} from '../../vendor/mitt/src/index.js'; } from '../../vendor/mitt/src/index.js';
/**
* @public
*/
export { EventType, Handler };
/** /**
* @public * @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 | * {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe |
* frame } has "default" execution context that is always created after frame is * frame } has "default" execution context that is always created after frame is
* attached to DOM. This context is returned by the * 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 * - {@link https://developer.chrome.com/extensions | Extension}'s content scripts
* create additional execution contexts. * create additional execution contexts.
* *

View File

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

View File

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

View File

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

View File

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

View File

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