Skip to content

Commit 390ddd9

Browse files
Merge pull request #14181 from PinRathod/simpleviewer_to_async
Converted simpleviewer.js to await/async
2 parents 1ab9a6e + 4c463c6 commit 390ddd9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/components/simpleviewer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ const loadingTask = pdfjsLib.getDocument({
9292
cMapPacked: CMAP_PACKED,
9393
enableXfa: ENABLE_XFA,
9494
});
95-
loadingTask.promise.then(function (pdfDocument) {
95+
(async function () {
96+
const pdfDocument = await loadingTask.promise;
9697
// Document loaded, specifying document for the viewer and
9798
// the (optional) linkService.
9899
pdfViewer.setDocument(pdfDocument);
99100

100101
pdfLinkService.setDocument(pdfDocument, null);
101-
});
102+
})();

0 commit comments

Comments
 (0)