Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const task = schedule.scheduleJob(rule, function () {
i++
console.log('i---', i)
percollate.configure();
percollate.pdf(arr[i - 1], {
output: (i - 1) + name,
css,
usePup
});
if (i === arr.length) {
i = 0
// 获得未生成pdf文件的index值
unsavedFiles = utils.getUnsavedIndex(arr.length)
return
}
// 第一次生成失败的再次生成
if (unsavedFiles.length) {
percollate.configure();
percollate.pdf(arr[unsavedFiles[i - 1]], {
output: (unsavedFiles[i - 1]) + name,
percollate.configure();
percollate.pdf(arr[i - 1], {
output: (i - 1) + name,
css,
usePup
});
if (i === arr.length) {
i = 0
// 获得未生成pdf文件的index值
unsavedFiles = utils.getUnsavedIndex(arr.length)
return
}
// 第一次生成失败的再次生成
if (unsavedFiles.length) {
percollate.configure();
percollate.pdf(arr[unsavedFiles[i - 1]], {
output: (unsavedFiles[i - 1]) + name,
css,
usePup
});
} else {
utils.mergePdfs(arr.length, '廖雪峰JavaScript全栈教程.pdf')
task.cancel()
}
});
getHtml(pageApi).then(res => {
const urlList = getUrlList(res, wrapEle, url);
percollate.configure();
percollate.pdf(urlList, {
output: name,
css,
usePup
});
});
}