Skip to content

Commit

Permalink
refactor(pdf-viewer.component): consolidate if statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Bengejd committed Aug 30, 2024
1 parent 4015ebf commit 61340bb
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/app/pdf-viewer/pdf-viewer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ if (!isSSR()) {
}

// @ts-expect-error This does not exist outside of polyfill which this is doing
if (typeof Promise.withResolvers === 'undefined') {
if (window) {
// @ts-expect-error This does not exist outside of polyfill which this is doing
window.Promise.withResolvers = () => {
let resolve;
let reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { promise, resolve, reject };
};
}
if (typeof Promise.withResolvers === 'undefined' && window) {
// @ts-expect-error This does not exist outside of polyfill which this is doing
window.Promise.withResolvers = () => {
let resolve;
let reject;
const promise = new Promise((res, rej) => {
resolve = res;
reject = rej;
});
return { promise, resolve, reject };
};
}


Expand Down

0 comments on commit 61340bb

Please sign in to comment.