docs(api): fix lint in code snippets (#7012)

This commit is contained in:
David Barton 2021-03-22 07:12:55 +01:00 committed by GitHub
parent dc8ab6d8ca
commit ff860819a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -677,7 +677,7 @@ Puppeteer against it:
```js ```js
const browserFetcher = puppeteer.createBrowserFetcher(); const browserFetcher = puppeteer.createBrowserFetcher();
const revisionInfo = await browserFetcher.download('533271'); const revisionInfo = await browserFetcher.download('533271');
const browser = await puppeteer.launch({executablePath: revisionInfo.executablePath}) const browser = await puppeteer.launch({ executablePath: revisionInfo.executablePath });
``` ```
> **NOTE** BrowserFetcher is not designed to work concurrently with other > **NOTE** BrowserFetcher is not designed to work concurrently with other
@ -1313,7 +1313,7 @@ If there's no element matching `selector`, the method throws an error.
Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following: Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following:
```javascript ```js
const [response] = await Promise.all([ const [response] = await Promise.all([
page.waitForNavigation(waitOptions), page.waitForNavigation(waitOptions),
page.click(selector, clickOptions), page.click(selector, clickOptions),
@ -1586,7 +1586,7 @@ await resultHandle.dispose();
This function will return a [JSHandle] by default, however if your `pageFunction` returns an HTML element you will get back an `ElementHandle`: This function will return a [JSHandle] by default, however if your `pageFunction` returns an HTML element you will get back an `ElementHandle`:
```js ```js
const button = await page.evaluateHandle(() => document.querySelector('button')) const button = await page.evaluateHandle(() => document.querySelector('button'));
// button is an ElementHandle, so you can call methods such as click: // button is an ElementHandle, so you can call methods such as click:
await button.click(); await button.click();
``` ```
@ -1610,9 +1610,9 @@ An example of overriding the navigator.languages property before the page loads:
// preload.js // preload.js
// overwrite the `languages` property to use a custom getter // overwrite the `languages` property to use a custom getter
Object.defineProperty(navigator, "languages", { Object.defineProperty(navigator, 'languages', {
get: function() { get: function() {
return ["en-US", "en", "bn"]; return ['en-US', 'en', 'bn'];
} }
}); });
@ -2315,7 +2315,7 @@ return firstRequest.url();
```js ```js
const firstResponse = await page.waitForResponse('https://example.com/resource'); const firstResponse = await page.waitForResponse('https://example.com/resource');
const finalResponse = await page.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200); const finalResponse = await page.waitForResponse(response => response.url() === 'https://example.com' && response.status() === 200);
const finalResponse = await page.waitForResponse(async response => { return (await response.text()).includes('<html>') }) const finalResponse = await page.waitForResponse(async response => { return (await response.text()).includes('<html>') });
return finalResponse.ok(); return finalResponse.ok();
``` ```
@ -2735,7 +2735,7 @@ await page.mouse.move(
boundingBox.y + boundingBox.height / 2 boundingBox.y + boundingBox.height / 2
); );
await page.mouse.wheel({ deltaY: -100 }) await page.mouse.wheel({ deltaY: -100 });
``` ```
### class: Touchscreen ### class: Touchscreen
@ -2985,7 +2985,7 @@ If there's no element matching `selector`, the method throws an error.
Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following: Bear in mind that if `click()` triggers a navigation event and there's a separate `page.waitForNavigation()` promise to be resolved, you may end up with a race condition that yields unexpected results. The correct pattern for click and wait for navigation is the following:
```javascript ```js
const [response] = await Promise.all([ const [response] = await Promise.all([
page.waitForNavigation(waitOptions), page.waitForNavigation(waitOptions),
frame.click(selector, clickOptions), frame.click(selector, clickOptions),