Skip to content

Commit

Permalink
fix(pdf-viewer): fix type on prop config
Browse files Browse the repository at this point in the history
  • Loading branch information
adenvt committed Sep 13, 2024
1 parent 0d985cc commit 7e50834
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/components/pdf-viewer/__mocks__/use-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export const openDoc = vi.fn((src: string, password?: string) => {

void errorEvent.trigger(context.error)
} else {
void loadingEvent.trigger({ total: 100, loaded: 10 })

context.ready = true
context.totalPage = 5

Expand Down
8 changes: 4 additions & 4 deletions src/components/pdf-viewer/utils/use-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import {
} from './pdfjs'

export interface OpenDocConfig {
disableStream: boolean,
disableRange: boolean,
httpHeaders: Object,
disableStream?: boolean,
disableRange?: boolean,
httpHeaders?: Object,
}

export function useViewer (container: Ref<HTMLDivElement>, viewer: Ref<HTMLDivElement>) {
Expand All @@ -46,7 +46,7 @@ export function useViewer (container: Ref<HTMLDivElement>, viewer: Ref<HTMLDivEl
const errorEvent = createEventHook<Error>()
const readyEvent = createEventHook<PDFJSViewer.PDFViewer>()

async function openDoc (url: string, password?: string, config: Partial<OpenDocConfig> = {}) {
async function openDoc (url: string, password?: string, config: OpenDocConfig = {}) {
loading.value = true
error.value = undefined

Expand Down

0 comments on commit 7e50834

Please sign in to comment.