Skip to content

Commit

Permalink
fix: expose Viewport type (puppeteer#6881)
Browse files Browse the repository at this point in the history
Also includes drive-by when I subbed `@default` (not valid) to
`@defaultValue` (valid!) in a few places and exposed types from
`Coverage.ts` so they get exposed too.

Fixes 6876.
  • Loading branch information
jackfranklin authored Feb 12, 2021
1 parent 29c0594 commit be7c229
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/api-docs-entry.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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;
}

0 comments on commit be7c229

Please sign in to comment.