mirror of
https://github.com/astefanutti/decktape.git
synced 2024-09-11 14:25:44 +03:00
make two url loading timeouts options
This commit is contained in:
parent
0c11545823
commit
8d581f4596
@ -126,6 +126,10 @@ Options:
|
|||||||
-p <ms>, --pause <ms> Duration in milliseconds before each slide is exported [1000]
|
-p <ms>, --pause <ms> Duration in milliseconds before each slide is exported [1000]
|
||||||
--load-pause <ms> Duration in milliseconds between the page has loaded
|
--load-pause <ms> Duration in milliseconds between the page has loaded
|
||||||
and starting to export slides [0]
|
and starting to export slides [0]
|
||||||
|
--url-load-timeout <ms> Timeout in milliseconds to use when waiting for the initial
|
||||||
|
URL to load [60000]
|
||||||
|
--page-load-timeout <ms> Timeout in milliseconds to use when waiting for the slide deck
|
||||||
|
page to load [20000]
|
||||||
--screenshots Capture each slide as an image [false]
|
--screenshots Capture each slide as an image [false]
|
||||||
--screenshots-directory <dir> Screenshots output directory [screenshots]
|
--screenshots-directory <dir> Screenshots output directory [screenshots]
|
||||||
--screenshots-size <size> Screenshots resolution, can be repeated [--size]
|
--screenshots-size <size> Screenshots resolution, can be repeated [--size]
|
||||||
|
16
decktape.js
16
decktape.js
@ -51,6 +51,18 @@ parser.script('decktape').options({
|
|||||||
default : 0,
|
default : 0,
|
||||||
help : 'Duration in milliseconds between the page has loaded and starting to export slides',
|
help : 'Duration in milliseconds between the page has loaded and starting to export slides',
|
||||||
},
|
},
|
||||||
|
urlLoadTimeout: {
|
||||||
|
full: 'url-load-timeout',
|
||||||
|
metavar: '<ms>',
|
||||||
|
default: 60000,
|
||||||
|
help: 'Timeout in milliseconds to use when waiting for the initial URL to load',
|
||||||
|
},
|
||||||
|
pageLoadTimeout: {
|
||||||
|
full: 'page-load-timeout',
|
||||||
|
metavar: '<ms>',
|
||||||
|
default: 20000,
|
||||||
|
help: 'Timeout in milliseconds to use when waiting for the slide deck page to load',
|
||||||
|
},
|
||||||
screenshots : {
|
screenshots : {
|
||||||
default : false,
|
default : false,
|
||||||
flag : true,
|
flag : true,
|
||||||
@ -242,8 +254,8 @@ process.on('unhandledRejection', error => {
|
|||||||
.on('pageerror', error => console.log(chalk`\n{red Page error: ${error.message}}`));
|
.on('pageerror', error => console.log(chalk`\n{red Page error: ${error.message}}`));
|
||||||
|
|
||||||
console.log('Loading page', options.url, '...');
|
console.log('Loading page', options.url, '...');
|
||||||
const load = page.waitForNavigation({ waitUntil: 'load', timeout: 20000 });
|
const load = page.waitForNavigation({ waitUntil: 'load', timeout: options.urlLoadTimeout });
|
||||||
page.goto(options.url, { waitUntil: 'networkidle0', timeout: 60000 })
|
page.goto(options.url, { waitUntil: 'networkidle0', timeout: options.pageLoadTimeout })
|
||||||
// wait until the load event is dispatched
|
// wait until the load event is dispatched
|
||||||
.then(response => load
|
.then(response => load
|
||||||
.catch(error => response.status() !== 200 ? Promise.reject(error) : response)
|
.catch(error => response.status() !== 200 ? Promise.reject(error) : response)
|
||||||
|
Loading…
Reference in New Issue
Block a user