New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add preloadFunction
option
#76
Conversation
index.d.ts
Outdated
@@ -164,6 +164,11 @@ declare namespace captureWebsite { | |||
*/ | |||
readonly isJavaScriptEnabled?: boolean; | |||
|
|||
/** | |||
Inject a function to be executed prior to navigation; useful for [altering the JavaScript environment](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pageevaluateonnewdocumentpagefunction-args). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readme and index.d.ts docs should be in sync.
readme.md
Outdated
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. | ||
|
||
*This option applies only to `captureWebsite.file()`.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is misplaced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️
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; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation has been cleaned up. |
https://github.com/sindresorhus/capture-website/releases/tag/v1.4.0 Can be done now :) |
Updates from #66; Fixes #48.
I'll follow with corresponding additions to https://github.com/sindresorhus/capture-website-cli.