Skip to content
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

fix: expose ScreenshotOptions type in type defs #6869

Merged
merged 2 commits into from Feb 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 36 additions & 3 deletions src/common/Page.ts
Expand Up @@ -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';
}

/**
Expand Down