capture-website
Advanced tools
Comparing version 1.3.0 to 1.4.0
/// <reference lib="dom"/> | ||
import {SetCookie, LaunchOptions, Page, Browser, Headers} from 'puppeteer'; | ||
import {SetCookie, LaunchOptions, Page, Browser, Headers, EvaluateFn} from 'puppeteer'; | ||
@@ -168,2 +168,9 @@ declare namespace captureWebsite { | ||
/** | ||
Inject a function to be executed prior to navigation. | ||
This can be useful for [altering the JavaScript environment](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pageevaluateonnewdocumentpagefunction-args). For example, you could define a global method on the `window`, overwrite `navigator.languages` to change the language presented by the browser, or mock `Math.random` to return a fixed value. | ||
*/ | ||
readonly preloadFunction?: EvaluateFn; | ||
/** | ||
Inject [JavaScript modules](https://developers.google.com/web/fundamentals/primers/modules) into the page. | ||
@@ -170,0 +177,0 @@ |
@@ -184,2 +184,6 @@ /* global document */ | ||
if (options.preloadFunction) { | ||
await page.evaluateOnNewDocument(options.preloadFunction); | ||
} | ||
await page.setJavaScriptEnabled(options.isJavaScriptEnabled); | ||
@@ -186,0 +190,0 @@ |
{ | ||
"name": "capture-website", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Capture screenshots of websites", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -479,2 +479,11 @@ # capture-website | ||
##### preloadFunction | ||
Type: `string | Function`\ | ||
Default: `undefined` | ||
Inject a function to be executed prior to navigation. | ||
This can be useful for [altering the JavaScript environment](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pageevaluateonnewdocumentpagefunction-args). For example, you could define a global method on the `window`, overwrite `navigator.languages` to change the language presented by the browser, or mock `Math.random` to return a fixed value. | ||
### captureWebsite.devices | ||
@@ -481,0 +490,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37638
602
552