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): migrate ConsoleMessage docs to TSDoc #6065
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ text(): string; | |
|
||
string | ||
|
||
The text of the console message. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) > [columnNumber](./puppeteer.consolemessagelocation.columnnumber.md) | ||
|
||
## ConsoleMessageLocation.columnNumber property | ||
|
||
0-based column number in the resource if known or `undefined` otherwise. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
columnNumber?: number; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) > [lineNumber](./puppeteer.consolemessagelocation.linenumber.md) | ||
|
||
## ConsoleMessageLocation.lineNumber property | ||
|
||
0-based line number in the resource if known or `undefined` otherwise. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
lineNumber?: number; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) | ||
|
||
## ConsoleMessageLocation interface | ||
|
||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ConsoleMessageLocation | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [columnNumber](./puppeteer.consolemessagelocation.columnnumber.md) | number | 0-based column number in the resource if known or <code>undefined</code> otherwise. | | ||
| [lineNumber](./puppeteer.consolemessagelocation.linenumber.md) | number | 0-based line number in the resource if known or <code>undefined</code> otherwise. | | ||
| [url](./puppeteer.consolemessagelocation.url.md) | string | URL of the resource if known or <code>undefined</code> otherwise. | | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ConsoleMessageLocation](./puppeteer.consolemessagelocation.md) > [url](./puppeteer.consolemessagelocation.url.md) | ||
|
||
## ConsoleMessageLocation.url property | ||
|
||
URL of the resource if known or `undefined` otherwise. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
url?: string; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [ConsoleMessageType](./puppeteer.consolemessagetype.md) | ||
|
||
## ConsoleMessageType type | ||
|
||
The supported types for console messages. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare type ConsoleMessageType = 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd' | 'verbose'; | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,20 +16,55 @@ | |
|
||
import { JSHandle } from './JSHandle'; | ||
|
||
interface ConsoleMessageLocation { | ||
/** | ||
* @public | ||
*/ | ||
export interface ConsoleMessageLocation { | ||
/** | ||
* URL of the resource if known or `undefined` otherwise. | ||
*/ | ||
url?: string; | ||
|
||
/** | ||
* 0-based line number in the resource if known or `undefined` otherwise. | ||
*/ | ||
lineNumber?: number; | ||
|
||
/** | ||
* 0-based column number in the resource if known or `undefined` otherwise. | ||
*/ | ||
columnNumber?: number; | ||
} | ||
|
||
// Prettier seems to struggle with the ConsoleMessageType declaration | ||
// so it is switched off just for that block. | ||
/* eslint-disable prettier/prettier */ | ||
|
||
/** | ||
* The supported types for console messages. | ||
*/ | ||
export type ConsoleMessageType = 'log' | 'debug' | 'info' | 'error' | 'warning' | | ||
'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | | ||
'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | | ||
'profileEnd' | 'count' | 'timeEnd' | 'verbose'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this type already exist in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It turns out no. While there is something similar in the protocol, because it's autogenerated we can't get at the values. |
||
|
||
/* eslint-enable prettier/prettier */ | ||
|
||
/** | ||
* ConsoleMessage objects are dispatched by page via the 'console' event. | ||
* @public | ||
*/ | ||
export class ConsoleMessage { | ||
private _type: string; | ||
private _type: ConsoleMessageType; | ||
private _text: string; | ||
private _args: JSHandle[]; | ||
private _location: ConsoleMessageLocation; | ||
|
||
/** | ||
* @public | ||
*/ | ||
constructor( | ||
type: string, | ||
type: ConsoleMessageType, | ||
text: string, | ||
args: JSHandle[], | ||
location: ConsoleMessageLocation = {} | ||
|
@@ -40,18 +75,30 @@ export class ConsoleMessage { | |
this._location = location; | ||
} | ||
|
||
type(): string { | ||
/** | ||
* @returns The type of the console message. | ||
*/ | ||
type(): ConsoleMessageType { | ||
return this._type; | ||
} | ||
|
||
/** | ||
* @returns The text of the console message. | ||
*/ | ||
text(): string { | ||
return this._text; | ||
} | ||
|
||
/** | ||
* @returns An array of arguments passed to the console. | ||
*/ | ||
args(): JSHandle[] { | ||
return this._args; | ||
} | ||
|
||
/** | ||
* @returns The location of the console message. | ||
*/ | ||
location(): ConsoleMessageLocation { | ||
return this._location; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean by struggle? https://prettier.io/playground/#N4Igxg9gdgLgprEAuEcAeAHCAnGACGATwzjwGFoBnCAGzgFk5LKBDAczgBVjSBePAOQ0IbAXgA+ggCZwARgFdREwQEsoAMwhjJAuNmw5tggO4tsUNUvEAdKHnvSV2IwKlO0AWxouYLWXR9sFjA4FzA6MxdKX1wAcQN5DG1bB0Fosxh4iESKGhoWDEo4KRcEKSzElxZmPRgXDAN1FQCJFIcBBogmugBRKBLlAUh5WB8VDzg+gZ0ANz1ZCCKBAG5bEAAaEAgMGBUqZFAzA2MABTMESmQQFhpTQkvN2SCwAGs4GABlDGDLZBhseRwTYACxgXgA6sCVPBKN8Qh8LtCVDNoYQrmBmBsQGoirgTkE2B4WMh1DcipsAFaUNAAIWeb0+LAmABk1HASWSgSAqWgPpY6ABFeQQeAcmjkkDfbC4q6yPxwGhYhpqGDglRSGDA5AADgADJtOkVwUEMFcGkw9HMsQBHYXwfHbS4oaoAWigcGKxSx2DgtqccHx7CJYolRQ8Kj+AK5lH5cCFIvZSFJ4q5vlkao1WqQACZNv8WM1LBQPMGUEwAKxY+RFTh+J3JiUzQEASX6CE+YGwKh2AEF+h8iHQQ3AAL4joA seems OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I don't know. As per our offline conversation, it seems unhappy in the context of the file itself. Maybe a version difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah maybe! Let's leave this be for now. Not worth blocking.