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 Viewport type #6881

Merged
merged 1 commit into from Feb 12, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/api-docs-entry.ts
Expand Up @@ -40,6 +40,7 @@ export * from './common/Accessibility.js';
export * from './common/Browser.js';
export * from './node/BrowserFetcher.js';
export * from './node/Puppeteer.js';
export * from './common/Coverage.js';
export * from './common/Connection.js';
export * from './common/ConsoleMessage.js';
export * from './common/Coverage.js';
Expand All @@ -51,6 +52,7 @@ export * from './common/ExecutionContext.js';
export * from './common/EventEmitter.js';
export * from './common/FileChooser.js';
export * from './common/FrameManager.js';
export * from './common/PuppeteerViewport.js';
export * from './common/Input.js';
export * from './common/Page.js';
export * from './common/Product.js';
Expand Down
8 changes: 4 additions & 4 deletions src/common/Page.ts
Expand Up @@ -150,7 +150,7 @@ export interface ScreenshotClip {
*/
export interface ScreenshotOptions {
/**
* @default 'png'
* @defaultValue 'png'
*/
type?: 'png' | 'jpeg';
/**
Expand All @@ -162,7 +162,7 @@ export interface ScreenshotOptions {
path?: string;
/**
* When true, takes a screenshot of the full page.
* @default false
* @defaultValue false
*/
fullPage?: boolean;
/**
Expand All @@ -175,12 +175,12 @@ export interface ScreenshotOptions {
quality?: number;
/**
* Hides default white background and allows capturing screenshots with transparency.
* @default false
* @defaultValue false
*/
omitBackground?: boolean;
/**
* Encoding of the image.
* @default 'binary'
* @defaultValue 'binary'
*/
encoding?: 'base64' | 'binary';
}
Expand Down
28 changes: 28 additions & 0 deletions src/common/PuppeteerViewport.ts
Expand Up @@ -13,11 +13,39 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
* Sets the viewport of the page.
* @public
*/
export interface Viewport {
/**
* The page width in pixels.
*/
width: number;
/**
* The page height in pixels.
*/
height: number;
/**
* Specify device scale factor.
* See {@link https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio | devicePixelRatio} for more info.
* @defaultValue 1
*/
deviceScaleFactor?: number;
/**
* Whether the `meta viewport` tag is taken into account.
* @defaultValue false
*/
isMobile?: boolean;
/**
* Specifies if the viewport is in landscape mode.
* @defaultValue false
*/
isLandscape?: boolean;
/**
* Specify if the viewport supports touch events.
* @defaultValue false
*/
hasTouch?: boolean;
}