Skip to content

Commit 64ac849

Browse files
committed
feat: add pdf worker warmup helper
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 71316e2 commit 64ac849

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/utils/asyncReader.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ export function setWorkerPath(path: string) {
6666
}
6767
}
6868

69+
export async function ensureWorkerReady(): Promise<void> {
70+
const pdfjs = await loadPdfjs()
71+
await getSharedWorker(pdfjs)
72+
}
73+
6974
export function readAsArrayBuffer(file: Blob): Promise<ArrayBuffer> {
7075
return new Promise((resolve, reject) => {
7176
const reader = new FileReader()

0 commit comments

Comments
 (0)