withResolvers() try again
Some checks failed
Build and Publish Docker Image / build (push) Has been cancelled

This commit is contained in:
Richard Roberson 2025-03-04 14:27:05 -07:00
parent b411a87f08
commit 4e857a75f0
3 changed files with 15 additions and 2 deletions

View file

@ -1,6 +1,6 @@
{
"name": "openreader-webui",
"version": "0.2.4-patch.1",
"version": "0.2.4-patch.2",
"private": true,
"scripts": {
"dev": "next dev --turbopack -p 3003",

View file

@ -20,6 +20,18 @@
* JavaScript code in this page
*/
// Add polyfill before any code that uses Promise.withResolvers
if (typeof Promise.withResolvers === 'undefined') {
Promise.withResolvers = function () {
let resolve, reject
const promise = new Promise((res, rej) => {
resolve = res
reject = rej
})
return { promise, resolve, reject }
}
}
/******/ var __webpack_modules__ = ({
/***/ 9306:
@ -3622,7 +3634,7 @@ var $ = __webpack_require__(6518);
var newPromiseCapabilityModule = __webpack_require__(6043);
// `Promise.withResolvers` method
// https://github.com/tc39/proposal-promise-with-resolvers
// // https://github.com/tc39/proposal-promise-with-resolvers
$({ target: 'Promise', stat: true }, {
withResolvers: function withResolvers() {
var promiseCapability = newPromiseCapabilityModule.f(this);

View file

@ -36,6 +36,7 @@ function initPDFWorker() {
const workerSrc = useLegacy ? '/pdf.legacy.worker.mjs' : '/pdf.worker.mjs';
console.log('Setting PDF worker to:', workerSrc);
pdfjs.GlobalWorkerOptions.workerSrc = workerSrc;
pdfjs.GlobalWorkerOptions.workerPort = null;
}
} catch (e) {
console.error('Error setting PDF worker:', e);