From 4c974194f60d5e398d0ef28adc118baee04d4de9 Mon Sep 17 00:00:00 2001 From: Jack Franklin Date: Thu, 11 Feb 2021 08:43:47 +0000 Subject: [PATCH] fix: expose `ScreenshotOptions` type in type defs Fixes #6866. --- src/common/Page.ts | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/common/Page.ts b/src/common/Page.ts index cf313bcfbbc41..e5bb4d9958529 100644 --- a/src/common/Page.ts +++ b/src/common/Page.ts @@ -135,21 +135,54 @@ interface MediaFeature { value: string; } -interface ScreenshotClip { +/** + * @public + */ +export interface ScreenshotClip { x: number; y: number; width: number; height: number; } -interface ScreenshotOptions { +/** + * @public + */ +export interface ScreenshotOptions { + /** + * @default 'png' + */ type?: 'png' | 'jpeg'; + /** + * The file path to save the image to. The screenshot type will be inferred + * from file extension. If path is a relative path, then it is resolved + * relative to current working directory. If no path is provided, the image + * won't be saved to the disk. + */ path?: string; + /** + * When true, takes a screenshot of the full page. + * @default false + */ fullPage?: boolean; + /** + * An object which specifies the clipping region of the page. + */ clip?: ScreenshotClip; + /** + * Quality of the image, between 0-100. Not applicable to `png` images. + */ quality?: number; + /** + * Hides default white background and allows capturing screenshots with transparency. + * @default false + */ omitBackground?: boolean; - encoding?: string; + /** + * Encoding of the image. + * @default 'binary' + */ + encoding?: 'base64' | 'binary'; } /**