Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): fix DOMWorld doc warnings #6166

Merged
merged 1 commit into from Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion new-docs/puppeteer.frame.goto.md
Expand Up @@ -19,7 +19,7 @@ goto(url: string, options?: {
| Parameter | Type | Description |
| --- | --- | --- |
| url | string | |
| options | { referer?: string; timeout?: number; waitUntil?: PuppeteerLifeCycleEvent \| PuppeteerLifeCycleEvent\[\]; } | |
| options | { referer?: string; timeout?: number; waitUntil?: [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) \| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md)<!-- -->\[\]; } | |

<b>Returns:</b>

Expand Down
2 changes: 1 addition & 1 deletion new-docs/puppeteer.frame.setcontent.md
Expand Up @@ -18,7 +18,7 @@ setContent(html: string, options?: {
| Parameter | Type | Description |
| --- | --- | --- |
| html | string | |
| options | { timeout?: number; waitUntil?: PuppeteerLifeCycleEvent \| PuppeteerLifeCycleEvent\[\]; } | |
| options | { timeout?: number; waitUntil?: [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) \| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md)<!-- -->\[\]; } | |

<b>Returns:</b>

Expand Down
2 changes: 1 addition & 1 deletion new-docs/puppeteer.frame.waitfornavigation.md
Expand Up @@ -17,7 +17,7 @@ waitForNavigation(options?: {

| Parameter | Type | Description |
| --- | --- | --- |
| options | { timeout?: number; waitUntil?: PuppeteerLifeCycleEvent \| PuppeteerLifeCycleEvent\[\]; } | |
| options | { timeout?: number; waitUntil?: [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) \| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md)<!-- -->\[\]; } | |

<b>Returns:</b>

Expand Down
1 change: 1 addition & 0 deletions new-docs/puppeteer.md
Expand Up @@ -101,6 +101,7 @@
| [Platform](./puppeteer.platform.md) | Supported platforms. |
| [Product](./puppeteer.product.md) | Supported products. |
| [PuppeteerErrors](./puppeteer.puppeteererrors.md) | |
| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) | |
| [Serializable](./puppeteer.serializable.md) | |
| [SerializableOrJSHandle](./puppeteer.serializableorjshandle.md) | |
| [UnwrapElementHandle](./puppeteer.unwrapelementhandle.md) | Unwraps a DOM element out of an ElementHandle instance |
Expand Down
11 changes: 11 additions & 0 deletions new-docs/puppeteer.puppeteerlifecycleevent.md
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md)

## PuppeteerLifeCycleEvent type

<b>Signature:</b>

```typescript
export declare type PuppeteerLifeCycleEvent = 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
```
2 changes: 1 addition & 1 deletion new-docs/puppeteer.waitforoptions.md
Expand Up @@ -16,5 +16,5 @@ export interface WaitForOptions
| Property | Type | Description |
| --- | --- | --- |
| [timeout](./puppeteer.waitforoptions.timeout.md) | number | Maximum wait time in milliseconds, defaults to 30 seconds, pass <code>0</code> to disable the timeout. |
| [waitUntil](./puppeteer.waitforoptions.waituntil.md) | PuppeteerLifeCycleEvent \| PuppeteerLifeCycleEvent\[\] | |
| [waitUntil](./puppeteer.waitforoptions.waituntil.md) | [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md) \| [PuppeteerLifeCycleEvent](./puppeteer.puppeteerlifecycleevent.md)<!-- -->\[\] | |

2 changes: 2 additions & 0 deletions src/api-docs-entry.ts
Expand Up @@ -54,3 +54,5 @@ export * from './common/NetworkManager';
export * from './common/WebWorker';
export * from './common/USKeyboardLayout';
export * from './common/EvalTypes';
export * from './common/TimeoutSettings';
export * from './common/LifecycleWatcher';
46 changes: 10 additions & 36 deletions src/common/DOMWorld.ts
Expand Up @@ -48,15 +48,18 @@ export interface WaitForSelectorOptions {
* @internal
*/
export class DOMWorld {
_frameManager: FrameManager;
_frame: Frame;
_timeoutSettings: TimeoutSettings;
_documentPromise?: Promise<ElementHandle> = null;
_contextPromise?: Promise<ExecutionContext> = null;
private _frameManager: FrameManager;
private _frame: Frame;
private _timeoutSettings: TimeoutSettings;
private _documentPromise?: Promise<ElementHandle> = null;
private _contextPromise?: Promise<ExecutionContext> = null;

_contextResolveCallback?: (x?: ExecutionContext) => void = null;
private _contextResolveCallback?: (x?: ExecutionContext) => void = null;

_detached = false;
private _detached = false;
/**
* internal
*/
_waitTasks = new Set<WaitTask>();

constructor(
Expand All @@ -74,9 +77,6 @@ export class DOMWorld {
return this._frame;
}

/**
* @param {?ExecutionContext} context
*/
_setContext(context?: ExecutionContext): void {
if (context) {
this._contextResolveCallback.call(null, context);
Expand All @@ -102,9 +102,6 @@ export class DOMWorld {
);
}

/**
* @returns {!Promise<!ExecutionContext>}
*/
executionContext(): Promise<ExecutionContext> {
if (this._detached)
throw new Error(
Expand All @@ -121,11 +118,6 @@ export class DOMWorld {
return context.evaluateHandle(pageFunction, ...args);
}

/**
* @param {Function|string} pageFunction
* @param {!Array<*>} args
* @returns {!Promise<*>}
*/
async evaluate<ReturnType extends any>(
pageFunction: Function | string,
...args: unknown[]
Expand All @@ -134,10 +126,6 @@ export class DOMWorld {
return context.evaluate<ReturnType>(pageFunction, ...args);
}

/**
* @param {string} selector
* @returns {!Promise<?ElementHandle>}
*/
async $(selector: string): Promise<ElementHandle | null> {
const document = await this._document();
const value = await document.$(selector);
Expand Down Expand Up @@ -188,10 +176,6 @@ export class DOMWorld {
return value;
}

/**
* @param {string} selector
* @returns {!Promise<!Array<!ElementHandle>>}
*/
async $$(selector: string): Promise<ElementHandle[]> {
const document = await this._document();
const value = await document.$$(selector);
Expand Down Expand Up @@ -249,8 +233,6 @@ export class DOMWorld {
* You can pass a URL, filepath or string of contents. Note that when running Puppeteer
* in a browser environment you cannot pass a filepath and should use either
* `url` or `content`.
*
* @param options
*/
async addScriptTag(options: {
url?: string;
Expand Down Expand Up @@ -340,7 +322,6 @@ export class DOMWorld {
* in a browser environment you cannot pass a filepath and should use either
* `url` or `content`.
*
* @param options
*/
async addStyleTag(options: {
url?: string;
Expand Down Expand Up @@ -541,13 +522,6 @@ export class DOMWorld {
}
return handle.asElement();

/**
* @param {string} selectorOrXPath
* @param {boolean} isXPath
* @param {boolean} waitForVisible
* @param {boolean} waitForHidden
* @returns {?Node|boolean}
*/
function predicate(
selectorOrXPath: string,
isXPath: boolean,
Expand Down
3 changes: 3 additions & 0 deletions src/common/LifecycleWatcher.ts
Expand Up @@ -43,6 +43,9 @@ const puppeteerToProtocolLifecycle = new Map<
['networkidle2', 'networkAlmostIdle'],
]);

/**
* @internal
*/
export class LifecycleWatcher {
_expectedLifecycle: ProtocolLifeCycleEvent[];
_frameManager: FrameManager;
Expand Down
6 changes: 3 additions & 3 deletions src/common/TimeoutSettings.ts
Expand Up @@ -16,6 +16,9 @@

const DEFAULT_TIMEOUT = 30000;

/**
* @internal
*/
export class TimeoutSettings {
_defaultTimeout: number | null;
_defaultNavigationTimeout: number | null;
Expand All @@ -29,9 +32,6 @@ export class TimeoutSettings {
this._defaultTimeout = timeout;
}

/**
* @param {number} timeout
*/
setDefaultNavigationTimeout(timeout: number): void {
this._defaultNavigationTimeout = timeout;
}
Expand Down