docs: prefer ts code block (#11389)

This commit is contained in:
Nikolay Vitkov 2023-11-14 13:39:58 +01:00 committed by GitHub
parent 52263f7241
commit a9e959e8fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 10 deletions

View File

@ -54,7 +54,7 @@ HTML:
JavaScript: JavaScript:
```js ```ts
const feedHandle = await page.$('.feed'); const feedHandle = await page.$('.feed');
expect( expect(
await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText)) await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))

View File

@ -43,6 +43,6 @@ A promise to the result of the function.
## Example ## Example
```js ```ts
const divsCounts = await frame.$$eval('div', divs => divs.length); const divsCounts = await frame.$$eval('div', divs => divs.length);
``` ```

View File

@ -5,7 +5,7 @@ continued, responded or aborted.
An example of a naïve request interceptor that aborts all image requests: An example of a naïve request interceptor that aborts all image requests:
```js ```ts
import puppeteer from 'puppeteer'; import puppeteer from 'puppeteer';
(async () => { (async () => {
@ -47,7 +47,7 @@ block. Always execute `request.isInterceptResolutionHandled` and
This example demonstrates two synchronous handlers working together: This example demonstrates two synchronous handlers working together:
```js ```ts
/* /*
This first handler will succeed in calling request.continue because the request interception has never been resolved. This first handler will succeed in calling request.continue because the request interception has never been resolved.
*/ */
@ -68,7 +68,7 @@ page.on('request', interceptedRequest => {
This example demonstrates asynchronous handlers working together: This example demonstrates asynchronous handlers working together:
```js ```ts
/* /*
This first handler will succeed in calling request.continue because the request interception has never been resolved. This first handler will succeed in calling request.continue because the request interception has never been resolved.
*/ */
@ -110,7 +110,7 @@ synchronously before using `abort/continue/respond`.
Here is the example above rewritten using `request.interceptResolutionState` Here is the example above rewritten using `request.interceptResolutionState`
```js ```ts
/* /*
This first handler will succeed in calling request.continue because the request interception has never been resolved. This first handler will succeed in calling request.continue because the request interception has never been resolved.
*/ */

View File

@ -3,8 +3,7 @@
:::caution :::caution
Chromium currently does not provide arm64 binaries for Linux. There are only Chromium currently does not provide arm64 binaries for Linux. There are only
binaries for binaries for Mac ARM.
[Mac ARM with experimental support from Puppeteer](https://pptr.dev/contributing#macos-arm-and-custom-executables).
::: :::

View File

@ -443,7 +443,7 @@ export abstract class ElementHandle<
* *
* JavaScript: * JavaScript:
* *
* ```js * ```ts
* const feedHandle = await page.$('.feed'); * const feedHandle = await page.$('.feed');
* expect( * expect(
* await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText)) * await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))

View File

@ -604,7 +604,7 @@ export abstract class Frame extends EventEmitter<FrameEvents> {
* *
* @example * @example
* *
* ```js * ```ts
* const divsCounts = await frame.$$eval('div', divs => divs.length); * const divsCounts = await frame.$$eval('div', divs => divs.length);
* ``` * ```
* *