Skip to content

Commit

Permalink
rename loadResource function
Browse files Browse the repository at this point in the history
  • Loading branch information
jackiequach committed Jul 5, 2024
1 parent 0386500 commit 13345bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/PdfReader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -36,7 +36,7 @@ export default function usePdfReader(args: PdfReaderArguments): ReaderReturn {
webpubManifestUrl,
manifest,
proxyUrl,
getContent = getContentDefault,
getContent = fetchAsUint8Array,
injectablesReflowable,
injectablesFixed,
height = DEFAULT_HEIGHT,
Expand Down
12 changes: 1 addition & 11 deletions src/PdfReader/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getResourceUrl = (
return readingOrder[index].href;
};

export const loadResource = async (
export const fetchAsUint8Array = async (
resourceUrl: string,
proxyUrl?: string
): Promise<Uint8Array> => {
Expand All @@ -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<Uint8Array> {
return loadResource(resourceUrl, proxyUrl);
}

/**
* Gets the index of the provided href in the readingOrder, or throws an error if one
* is not found.
Expand Down

0 comments on commit 13345bb

Please sign in to comment.