We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Promise.try
1 parent b4f513a commit 47776f6Copy full SHA for 47776f6
1 file changed
src/pdfjs-serverless/polyfills.mjs
@@ -10,6 +10,14 @@ if (typeof Promise.withResolvers === 'undefined') {
10
}
11
12
13
+// `Promise.try` is used by PDF.js v5.6+ in its message handler.
14
+// Not yet available in Safari < 18.2 and Node.js < 23.
15
+if (typeof Promise.try === 'undefined') {
16
+ Promise.try = function (fn, ...args) {
17
+ return new Promise(resolve => resolve(fn(...args)))
18
+ }
19
+}
20
+
21
// `Map.prototype.getOrInsertComputed` is used extensively by PDF.js v5.6+.
22
// Not yet available in most runtimes.
23
if (typeof Map.prototype.getOrInsertComputed === 'undefined') {
0 commit comments