From 13345bbb0db7f9d84ab1751413f545ba1bab73d0 Mon Sep 17 00:00:00 2001 From: Jackie Quach Date: Fri, 5 Jul 2024 09:58:16 -0400 Subject: [PATCH] rename loadResource function --- src/PdfReader/index.tsx | 4 ++-- src/PdfReader/lib.ts | 12 +----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/PdfReader/index.tsx b/src/PdfReader/index.tsx index 25864b77..af550e40 100644 --- a/src/PdfReader/index.tsx +++ b/src/PdfReader/index.tsx @@ -13,7 +13,7 @@ import { DEFAULT_SHOULD_GROW_WHEN_SCROLLING, } from '../constants'; import LoadingSkeleton from '../ui/LoadingSkeleton'; -import { getContentDefault, getResourceUrl, SCALE_STEP } from './lib'; +import { fetchAsUint8Array, getResourceUrl, SCALE_STEP } from './lib'; import { makePdfReducer } from './reducer'; import { PdfReaderArguments } from './types'; @@ -36,7 +36,7 @@ export default function usePdfReader(args: PdfReaderArguments): ReaderReturn { webpubManifestUrl, manifest, proxyUrl, - getContent = getContentDefault, + getContent = fetchAsUint8Array, injectablesReflowable, injectablesFixed, height = DEFAULT_HEIGHT, diff --git a/src/PdfReader/lib.ts b/src/PdfReader/lib.ts index 93ad52c0..e11e070a 100644 --- a/src/PdfReader/lib.ts +++ b/src/PdfReader/lib.ts @@ -16,7 +16,7 @@ export const getResourceUrl = ( return readingOrder[index].href; }; -export const loadResource = async ( +export const fetchAsUint8Array = async ( resourceUrl: string, proxyUrl?: string ): Promise => { @@ -33,16 +33,6 @@ export const loadResource = async ( return array; }; -/** - * Fetches a resource url as text - */ -export async function getContentDefault( - resourceUrl: string, - proxyUrl?: string -): Promise { - return loadResource(resourceUrl, proxyUrl); -} - /** * Gets the index of the provided href in the readingOrder, or throws an error if one * is not found.