-
-
Notifications
You must be signed in to change notification settings - Fork 742
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
#349 - added docs comments #357
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,42 +21,159 @@ import unusedFilename from 'unused-filename'; | |
const writeFile = promisify(fs.writeFile); | ||
|
||
export interface Options { | ||
/** | ||
* Delay capturing the screenshot (seconds). | ||
* | ||
* @default 0 | ||
*/ | ||
delay?: number; | ||
|
||
/** | ||
* Number of seconds after which the request is aborted. | ||
* | ||
* @default 60 | ||
*/ | ||
timeout?: number; | ||
|
||
/** | ||
* Crop to the set height. | ||
* | ||
* @default false | ||
*/ | ||
crop?: boolean; | ||
|
||
/** | ||
* Apply custom CSS to the webpage. | ||
*/ | ||
css?: string; | ||
|
||
/** | ||
* Apply custom JavaScript to the webpage. | ||
*/ | ||
script?: string; | ||
|
||
/** | ||
* A string with the same format as a browser cookie or an object. | ||
*/ | ||
cookies?: (string | {[key: string]: string})[]; | ||
|
||
/** | ||
* Define a customized filename using Lo-Dash templates. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The readme contains a lot more info that is missing here. |
||
*/ | ||
filename?: string; | ||
|
||
/** | ||
* When a file exists, append an incremental number. | ||
* | ||
* @default false | ||
*/ | ||
incrementalName?: boolean; | ||
|
||
/** | ||
* Capture a specific DOM element matching a CSS selector. | ||
*/ | ||
selector?: string; | ||
|
||
/** | ||
* Hide an array of DOM elements matching CSS selectors. | ||
*/ | ||
hide?: string[]; | ||
|
||
/** | ||
* Username for authenticating with HTTP auth. | ||
*/ | ||
username?: string; | ||
|
||
/** | ||
* Password for authenticating with HTTP auth. | ||
*/ | ||
password?: string; | ||
|
||
/** | ||
* Scale webpage number times. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a valid sentence. |
||
* | ||
* @default 1 | ||
*/ | ||
scale?: number; | ||
|
||
/** | ||
* Image format. | ||
* | ||
* @default png | ||
*/ | ||
format?: string; | ||
|
||
/** | ||
* Custom user agent. | ||
*/ | ||
userAgent?: string; | ||
|
||
/** | ||
* Custom HTTP request headers. | ||
*/ | ||
headers?: {[key: string]: string}; | ||
|
||
/** | ||
* Set background color to `transparent` instead of `white` if no background is set. | ||
* | ||
* @default false | ||
*/ | ||
transparent?: boolean; | ||
} | ||
|
||
export interface Source { | ||
/** | ||
* URL or local path to the website you want to screenshot. You can also use a data URI. | ||
*/ | ||
url: string; | ||
|
||
/** | ||
* Use a `<width>x<height>` notation or a keyword. | ||
*/ | ||
sizes: string[]; | ||
|
||
/** | ||
* Options set here will take precedence over the ones set in the constructor. | ||
*/ | ||
options?: Options; | ||
} | ||
|
||
/** | ||
* Set the destination directory. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comment is not correct. The type is the destination directory. |
||
*/ | ||
export type Destination = string; | ||
|
||
export interface Viewport { | ||
/** | ||
* URL or local path to the website you want to screenshot. You can also use a data URI. | ||
*/ | ||
url: string; | ||
|
||
/** | ||
* Use a <width>x<height> notation. | ||
*/ | ||
sizes: string[]; | ||
|
||
/** | ||
* A keyword is a version of a device. | ||
*/ | ||
keywords: string[]; | ||
} | ||
|
||
interface Stats { | ||
/** | ||
* Number of URLs. | ||
*/ | ||
urls?: number; | ||
|
||
/** | ||
* Number of sizes. | ||
*/ | ||
sizes?: number; | ||
|
||
/** | ||
* Number of screenshots. | ||
*/ | ||
screenshots?: number; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed my comment style. See sindresorhus/typescript-definition-style-guide@6a256ee