mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-14 11:05:52 +02:00
Use direct return await a bit more in the src/core/ folder
In these cases there's no need for a temporary variable, since the result of the asynchronous operation is returned as-is without any additional parsing.
This commit is contained in:
parent
54af145989
commit
5b26d8d413
@ -319,10 +319,7 @@ class AnnotationFactory {
|
|||||||
const pageRef = annotDict.getRaw("P");
|
const pageRef = annotDict.getRaw("P");
|
||||||
if (pageRef instanceof Ref) {
|
if (pageRef instanceof Ref) {
|
||||||
try {
|
try {
|
||||||
const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [
|
return await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
|
||||||
pageRef,
|
|
||||||
]);
|
|
||||||
return pageIndex;
|
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
info(`_getPageIndex -- not a valid page reference: "${ex}".`);
|
info(`_getPageIndex -- not a valid page reference: "${ex}".`);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -664,14 +664,14 @@ class WorkerMessageHandler {
|
|||||||
const pdfEditor = new PDFEditor();
|
const pdfEditor = new PDFEditor();
|
||||||
task = new WorkerTask(`ExtractPages: ${pageInfos.length} page(s)`);
|
task = new WorkerTask(`ExtractPages: ${pageInfos.length} page(s)`);
|
||||||
startWorkerTask(task);
|
startWorkerTask(task);
|
||||||
const buffer = await pdfEditor.extractPages(
|
|
||||||
|
return await pdfEditor.extractPages(
|
||||||
pageInfos,
|
pageInfos,
|
||||||
annotationStorage,
|
annotationStorage,
|
||||||
pdfManager.pdfDocument,
|
pdfManager.pdfDocument,
|
||||||
handler,
|
handler,
|
||||||
task
|
task
|
||||||
);
|
);
|
||||||
return buffer;
|
|
||||||
} catch (reason) {
|
} catch (reason) {
|
||||||
warn(`extractPages: "${reason}".`);
|
warn(`extractPages: "${reason}".`);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user