Skip to content

Commit 4e857a7

Browse files
committed
withResolvers() try again
1 parent b411a87 commit 4e857a7

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openreader-webui",
3-
"version": "0.2.4-patch.1",
3+
"version": "0.2.4-patch.2",
44
"private": true,
55
"scripts": {
66
"dev": "next dev --turbopack -p 3003",

public/pdf.legacy.worker.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
* JavaScript code in this page
2121
*/
2222

23+
// Add polyfill before any code that uses Promise.withResolvers
24+
if (typeof Promise.withResolvers === 'undefined') {
25+
Promise.withResolvers = function () {
26+
let resolve, reject
27+
const promise = new Promise((res, rej) => {
28+
resolve = res
29+
reject = rej
30+
})
31+
return { promise, resolve, reject }
32+
}
33+
}
34+
2335
/******/ var __webpack_modules__ = ({
2436

2537
/***/ 9306:
@@ -3622,7 +3634,7 @@ var $ = __webpack_require__(6518);
36223634
var newPromiseCapabilityModule = __webpack_require__(6043);
36233635

36243636
// `Promise.withResolvers` method
3625-
// https://github.com/tc39/proposal-promise-with-resolvers
3637+
// // https://github.com/tc39/proposal-promise-with-resolvers
36263638
$({ target: 'Promise', stat: true }, {
36273639
withResolvers: function withResolvers() {
36283640
var promiseCapability = newPromiseCapabilityModule.f(this);

src/utils/pdf.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function initPDFWorker() {
3636
const workerSrc = useLegacy ? '/pdf.legacy.worker.mjs' : '/pdf.worker.mjs';
3737
console.log('Setting PDF worker to:', workerSrc);
3838
pdfjs.GlobalWorkerOptions.workerSrc = workerSrc;
39+
pdfjs.GlobalWorkerOptions.workerPort = null;
3940
}
4041
} catch (e) {
4142
console.error('Error setting PDF worker:', e);

0 commit comments

Comments
 (0)