Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 027f66d

Browse filesBrowse files
fix: add navigator mock required for PDF.js 5.4.54+ (closes #42)
1 parent 40e0caf commit 027f66d
Copy full SHA for 027f66d

1 file changed

+5Lines changed: 5 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/pdfjs-serverless/mocks.mjs‎

Copy file name to clipboardExpand all lines: src/pdfjs-serverless/mocks.mjs
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@ if (typeof globalThis.FinalizationRegistry === 'undefined') {
1212
}
1313
}
1414

15+
// `navigator` is not available in serverless environments.
16+
globalThis.navigator ??= {}
17+
globalThis.navigator.platform ??= ''
18+
globalThis.navigator.userAgent ??= ''
19+
1520
// Export to ensure the mocks are not removed by tree-shaking.
1621
export const mocks = true

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.