mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs(new): Adds TSDoc to Tracing class (#6088)
* Adds tsdoc to Tracing class * Updates tsdocs Co-authored-by: martinsplitt <martin@geekonaut.de>
This commit is contained in:
parent
60904da4cd
commit
a46c78fc91
@ -34,7 +34,7 @@
|
|||||||
| [Target](./puppeteer.target.md) | |
|
| [Target](./puppeteer.target.md) | |
|
||||||
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
|
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
|
||||||
| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. |
|
| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. |
|
||||||
| [Tracing](./puppeteer.tracing.md) | |
|
| [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. |
|
||||||
| [WebWorker](./puppeteer.webworker.md) | The WebWorker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)<!-- -->. |
|
| [WebWorker](./puppeteer.webworker.md) | The WebWorker class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API)<!-- -->. |
|
||||||
|
|
||||||
## Enumerations
|
## Enumerations
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Tracing](./puppeteer.tracing.md) > [(constructor)](./puppeteer.tracing._constructor_.md)
|
|
||||||
|
|
||||||
## Tracing.(constructor)
|
|
||||||
|
|
||||||
Constructs a new instance of the `Tracing` class
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
constructor(client: CDPSession);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| client | [CDPSession](./puppeteer.cdpsession.md) | |
|
|
||||||
|
|
@ -4,17 +4,29 @@
|
|||||||
|
|
||||||
## Tracing class
|
## Tracing class
|
||||||
|
|
||||||
|
The Tracing class exposes the tracing audit interface.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
export declare class Tracing
|
export declare class Tracing
|
||||||
```
|
```
|
||||||
|
|
||||||
## Constructors
|
## Remarks
|
||||||
|
|
||||||
| Constructor | Modifiers | Description |
|
You can use `tracing.start` and `tracing.stop` to create a trace file which can be opened in Chrome DevTools or [timeline viewer](https://chromedevtools.github.io/timeline-viewer/)<!-- -->.
|
||||||
| --- | --- | --- |
|
|
||||||
| [(constructor)(client)](./puppeteer.tracing._constructor_.md) | | Constructs a new instance of the <code>Tracing</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 `Tracing` class.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
await page.tracing.start({path: 'trace.json'});
|
||||||
|
await page.goto('https://www.google.com');
|
||||||
|
await page.tracing.stop();
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|
||||||
@ -28,6 +40,6 @@ export declare class Tracing
|
|||||||
|
|
||||||
| Method | Modifiers | Description |
|
| Method | Modifiers | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [start(options)](./puppeteer.tracing.start.md) | | |
|
| [start(options)](./puppeteer.tracing.start.md) | | Starts a trace for the current page. |
|
||||||
| [stop()](./puppeteer.tracing.stop.md) | | |
|
| [stop()](./puppeteer.tracing.stop.md) | | Stops a trace started with the <code>start</code> method. |
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
## Tracing.start() method
|
## Tracing.start() method
|
||||||
|
|
||||||
|
Starts a trace for the current page.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
@ -14,9 +16,13 @@ start(options?: TracingOptions): Promise<void>;
|
|||||||
|
|
||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| options | TracingOptions | |
|
| options | TracingOptions | Optional <code>TracingOptions</code>. |
|
||||||
|
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
Promise<void>
|
Promise<void>
|
||||||
|
|
||||||
|
## Remarks
|
||||||
|
|
||||||
|
Only one trace can be active at a time per browser.
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
## Tracing.stop() method
|
## Tracing.stop() method
|
||||||
|
|
||||||
|
Stops a trace started with the `start` method.
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
@ -13,3 +15,5 @@ stop(): Promise<Buffer>;
|
|||||||
|
|
||||||
Promise<Buffer>
|
Promise<Buffer>
|
||||||
|
|
||||||
|
Promise which resolves to buffer with trace data.
|
||||||
|
|
||||||
|
@ -23,15 +23,37 @@ interface TracingOptions {
|
|||||||
categories?: string[];
|
categories?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Tracing class exposes the tracing audit interface.
|
||||||
|
* @remarks
|
||||||
|
* You can use `tracing.start` and `tracing.stop` to create a trace file
|
||||||
|
* which can be opened in Chrome DevTools or {@link https://chromedevtools.github.io/timeline-viewer/ | timeline viewer}.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```js
|
||||||
|
* await page.tracing.start({path: 'trace.json'});
|
||||||
|
* await page.goto('https://www.google.com');
|
||||||
|
* await page.tracing.stop();
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
export class Tracing {
|
export class Tracing {
|
||||||
_client: CDPSession;
|
_client: CDPSession;
|
||||||
_recording = false;
|
_recording = false;
|
||||||
_path = '';
|
_path = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
constructor(client: CDPSession) {
|
constructor(client: CDPSession) {
|
||||||
this._client = client;
|
this._client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a trace for the current page.
|
||||||
|
* @remarks
|
||||||
|
* Only one trace can be active at a time per browser.
|
||||||
|
* @param options - Optional `TracingOptions`.
|
||||||
|
*/
|
||||||
async start(options: TracingOptions = {}): Promise<void> {
|
async start(options: TracingOptions = {}): Promise<void> {
|
||||||
assert(
|
assert(
|
||||||
!this._recording,
|
!this._recording,
|
||||||
@ -68,6 +90,10 @@ export class Tracing {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops a trace started with the `start` method.
|
||||||
|
* @returns Promise which resolves to buffer with trace data.
|
||||||
|
*/
|
||||||
async stop(): Promise<Buffer> {
|
async stop(): Promise<Buffer> {
|
||||||
let fulfill: (value: Buffer) => void;
|
let fulfill: (value: Buffer) => void;
|
||||||
const contentPromise = new Promise<Buffer>((x) => (fulfill = x));
|
const contentPromise = new Promise<Buffer>((x) => (fulfill = x));
|
||||||
|
Loading…
Reference in New Issue
Block a user