mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs: prefer ts code block (#11389)
This commit is contained in:
parent
52263f7241
commit
a9e959e8fe
@ -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))
|
||||||
|
@ -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);
|
||||||
```
|
```
|
||||||
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
@ -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).
|
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
@ -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))
|
||||||
|
@ -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);
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user