Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

pageres

Package Overview
Dependencies
187
Maintainers
3
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.2.4 to 6.3.0

28

dist/index.d.ts
/// <reference types="node" />
import type { BeforeScreenshot } from 'capture-website';
import { EventEmitter } from 'events';

@@ -122,2 +123,29 @@ import captureWebsite = require('capture-website');

readonly launchOptions?: captureWebsite.Options['launchOptions'];
/**
The specified function is called right before the screenshot is captured. It receives the Puppeteer [`Page` instance](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) as the first argument and the [`browser` instance](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-browser) as the second argument. This gives you a lot of power to do custom stuff. The function can be async.
Note: Make sure to not call `page.close()` or `browser.close()`.
@example
```
const Pageres = require('pageres');
(async () => {
await new Pageres({
delay: 2,
beforeScreenshot: async (page, browser) => {
await checkSomething();
await page.click('#activate-button');
await page.waitForSelector('.finished');
}
})
.src('https://github.com/sindresorhus/pageres', ['480x320', '1024x768', 'iphone 5s'], {crop: true})
.dest(__dirname)
.run();
console.log('Finished generating screenshots!');
})();
```
*/
readonly beforeScreenShot?: BeforeScreenshot;
}

@@ -124,0 +152,0 @@ /**

3

dist/index.js

@@ -211,3 +211,4 @@ "use strict";

darkMode: options.darkMode,
launchOptions: options.launchOptions
launchOptions: options.launchOptions,
beforeScreenShot: options.beforeScreenShot
};

@@ -214,0 +215,0 @@ if (options.username && options.password) {

{
"name": "pageres",
"version": "6.2.4",
"version": "6.3.0",
"description": "Capture website screenshots",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -183,2 +183,30 @@ # ![pageres](media/promo.png)

##### beforeScreenshot
Type: `Function`
The specified function is called right before the screenshot is captured, as well as before any bounding rectangle is calculated as part of `options.element`. It receives the Puppeteer [`Page` instance](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-page) as the first argument and the [`browser` instance](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-browser) as the second argument. This gives you a lot of power to do custom stuff. The function can be async.
Note: Make sure to not call `page.close()` or `browser.close()`.
```js
const Pageres = require('pageres');
(async () => {
await new Pageres({
delay: 2,
beforeScreenshot: async (page, browser) => {
await checkSomething();
await page.click('#activate-button');
await page.waitForSelector('.finished');
}
})
.src('https://github.com/sindresorhus/pageres', ['480x320', '1024x768', 'iphone 5s'], {crop: true})
.dest(__dirname)
.run();
console.log('Finished generating screenshots!');
})();
```
### pageres.src(url, sizes, options?)

@@ -185,0 +213,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc