Skip to content
Snippets Groups Projects
Commit 6289364f authored by Nick Budak's avatar Nick Budak
Browse files

Implement --timeout option

Passes the -t/--timeout option from the command line to the
printer, and uses it to set the timeout when puppeteer is
loading pages.

See #28, #37
parent e12cd6da
No related branches found
No related tags found
1 merge request!16Implement --timeout option
......@@ -115,6 +115,7 @@ if (typeof input === "string") {
allowedPaths: program.allowedPaths,
allowedDomains: program.allowedDomains,
additionalScripts: program.additionalScript,
timeout: program.timeout,
};
if (program.forceTransparentBackground) {
......
......@@ -26,6 +26,7 @@ class Printer extends EventEmitter {
this.ignoreHTTPSErrors = options.ignoreHTTPSErrors;
this.browserWSEndpoint = options.browserEndpoint;
this.overrideDefaultBackgroundColor = options.overrideDefaultBackgroundColor;
this.timeout = options.timeout;
this.pages = [];
}
......@@ -63,6 +64,9 @@ class Printer extends EventEmitter {
}
const page = await this.browser.newPage();
if (this.timeout) {
page.setDefaultTimeout(this.timeout);
}
if (this.overrideDefaultBackgroundColor) {
page._client.send('Emulation.setDefaultBackgroundColorOverride', { color: this.overrideDefaultBackgroundColor });
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment