Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/gentle-seals-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@naverpay/react-pdf": patch
---

[react-pdf] Promise.withResolvers 추가

PR: [[react-pdf] Promise.withResolvers 추가](https://github.com/NaverPayDev/pie/pull/208)
4 changes: 4 additions & 0 deletions packages/react-pdf/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// pdfjs-dist에서 Promise.withResolvers를 사용하므로 polyfill 주입을 위해 호출
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
Promise.withResolvers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// polyfill 바닐라로 구현해서 넣기
if (typeof Promise.withResolvers !== 'function') {
  Promise.withResolvers = function <T>() {
    let resolve: (value: T | PromiseLike<T>) => void
    let reject: (reason?: unknown) => void
    const promise = new Promise<T>((res, rej) => {
      resolve = res
      reject = rej
    })
    return { promise, resolve: resolve!, reject: reject! }
  }
}
import 'core-js/actual/promise/with-resolvers'

https://app.unpkg.com/core-js@3.47.0/files/actual/promise/with-resolvers.js

둘중 하나가 맞을듯..


export * from './utils/pdf'
export * from './components/page/Canvas'
export * from './components/layer/Annotation'
Expand Down