mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: update documentation (#7446)
Reference `page.setOfflineMode` and `page.emulateNetworkConditions` from each other.
This commit is contained in:
parent
5eb20e29a2
commit
18ed92bd08
@ -1706,7 +1706,8 @@ await page.evaluate(() => matchMedia('print').matches);
|
|||||||
- `latency` <[number]> Latency (ms), `0` to disable
|
- `latency` <[number]> Latency (ms), `0` to disable
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
> **NOTE** This does not affect WebSockets and WebRTC PeerConnections (see https://crbug.com/563644)
|
> **NOTE** This does not affect WebSockets and WebRTC PeerConnections (see https://crbug.com/563644). To set the page offline, you can use [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
|
||||||
|
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const puppeteer = require('puppeteer');
|
const puppeteer = require('puppeteer');
|
||||||
@ -2323,9 +2324,11 @@ await page.setGeolocation({ latitude: 59.95, longitude: 30.31667 });
|
|||||||
|
|
||||||
#### page.setOfflineMode(enabled)
|
#### page.setOfflineMode(enabled)
|
||||||
|
|
||||||
- `enabled` <[boolean]> When `true`, enables offline mode for the page.
|
- `enabled` <[boolean]> When `true`, enables offline mode for the page.
|
||||||
- returns: <[Promise]>
|
- returns: <[Promise]>
|
||||||
|
|
||||||
|
> **NOTE** while this method sets the network connection to offline, it does not change the parameters used in [page.emulateNetworkConditions(networkConditions)](#pageemulatenetworkconditionsnetworkconditions).
|
||||||
|
|
||||||
#### page.setRequestInterception(value)
|
#### page.setRequestInterception(value)
|
||||||
|
|
||||||
- `value` <[boolean]> Whether to enable request interception.
|
- `value` <[boolean]> Whether to enable request interception.
|
||||||
|
@ -854,6 +854,10 @@ export class Page extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enabled - When `true`, enables offline mode for the page.
|
* @param enabled - When `true`, enables offline mode for the page.
|
||||||
|
* @remarks
|
||||||
|
* NOTE: while this method sets the network connection to offline, it does
|
||||||
|
* not change the parameters used in [page.emulateNetworkConditions(networkConditions)]
|
||||||
|
* (#pageemulatenetworkconditionsnetworkconditions)
|
||||||
*/
|
*/
|
||||||
setOfflineMode(enabled: boolean): Promise<void> {
|
setOfflineMode(enabled: boolean): Promise<void> {
|
||||||
return this._frameManager.networkManager().setOfflineMode(enabled);
|
return this._frameManager.networkManager().setOfflineMode(enabled);
|
||||||
@ -877,7 +881,8 @@ export class Page extends EventEmitter {
|
|||||||
* ```
|
* ```
|
||||||
* @remarks
|
* @remarks
|
||||||
* NOTE: This does not affect WebSockets and WebRTC PeerConnections (see
|
* NOTE: This does not affect WebSockets and WebRTC PeerConnections (see
|
||||||
* https://crbug.com/563644)
|
* https://crbug.com/563644). To set the page offline, you can use
|
||||||
|
* [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
|
||||||
*/
|
*/
|
||||||
emulateNetworkConditions(
|
emulateNetworkConditions(
|
||||||
networkConditions: NetworkConditions | null
|
networkConditions: NetworkConditions | null
|
||||||
|
Loading…
Reference in New Issue
Block a user