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

docs(new): adds TSDoc for Touchscreen class #6087

Merged
merged 1 commit into from Jun 24, 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.md
Expand Up @@ -33,7 +33,7 @@
| [SecurityDetails](./puppeteer.securitydetails.md) | The SecurityDetails class represents the security details of a response that was received over a secure connection. |
| [Target](./puppeteer.target.md) | |
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
| [Touchscreen](./puppeteer.touchscreen.md) | |
| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. |
| [Tracing](./puppeteer.tracing.md) | |
| [WebWorker](./puppeteer.webworker.md) | The WebWorker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)<!-- -->. |

Expand Down
21 changes: 0 additions & 21 deletions new-docs/puppeteer.touchscreen._constructor_.md

This file was deleted.

10 changes: 5 additions & 5 deletions new-docs/puppeteer.touchscreen.md
Expand Up @@ -4,17 +4,17 @@

## Touchscreen class

The Touchscreen class exposes touchscreen events.

<b>Signature:</b>

```typescript
export declare class Touchscreen
```

## Constructors
## Remarks

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(client, keyboard)](./puppeteer.touchscreen._constructor_.md) | | Constructs a new instance of the <code>Touchscreen</code> class |
The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Touchscreen` class.

## Properties

Expand All @@ -27,5 +27,5 @@ export declare class Touchscreen

| Method | Modifiers | Description |
| --- | --- | --- |
| [tap(x, y)](./puppeteer.touchscreen.tap.md) | | |
| [tap(x, y)](./puppeteer.touchscreen.tap.md) | | Dispatches a <code>touchstart</code> and <code>touchend</code> event. |

6 changes: 4 additions & 2 deletions new-docs/puppeteer.touchscreen.tap.md
Expand Up @@ -4,6 +4,8 @@

## Touchscreen.tap() method

Dispatches a `touchstart` and `touchend` event.

<b>Signature:</b>

```typescript
Expand All @@ -14,8 +16,8 @@ tap(x: number, y: number): Promise<void>;

| Parameter | Type | Description |
| --- | --- | --- |
| x | number | |
| y | number | |
| x | number | Horizontal position of the tap. |
| y | number | Vertical position of the tap. |

<b>Returns:</b>

Expand Down
11 changes: 9 additions & 2 deletions src/common/Input.ts
Expand Up @@ -238,18 +238,25 @@ export class Mouse {
}
}

/**
* The Touchscreen class exposes touchscreen events.
*/
export class Touchscreen {
_client: CDPSession;
_keyboard: Keyboard;

/**
* @internal
*/
constructor(client: CDPSession, keyboard: Keyboard) {
this._client = client;
this._keyboard = keyboard;
}

/**
* @param {number} x
* @param {number} y
* Dispatches a `touchstart` and `touchend` event.
* @param x - Horizontal position of the tap.
* @param y - Vertical position of the tap.
*/
async tap(x: number, y: number): Promise<void> {
// Touches appear to be lost during the first frame after navigation.
Expand Down