Jesus sucks
This commit is contained in:
31
backend/frontend/node_modules/@restart/hooks/cjs/useImage.d.ts
generated
vendored
Normal file
31
backend/frontend/node_modules/@restart/hooks/cjs/useImage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
type State = {
|
||||
image: HTMLImageElement | null;
|
||||
error: unknown | null;
|
||||
};
|
||||
/**
|
||||
* Fetch and load an image for programatic use such as in a `<canvas>` element.
|
||||
*
|
||||
* @param imageOrUrl The `HtmlImageElement` or image url to load
|
||||
* @param crossOrigin The `crossorigin` attribute to set
|
||||
*
|
||||
* ```ts
|
||||
* const { image, error } = useImage('/static/kittens.png')
|
||||
* const ref = useRef<HTMLCanvasElement>()
|
||||
*
|
||||
* useEffect(() => {
|
||||
* const ctx = ref.current.getContext('2d')
|
||||
*
|
||||
* if (image) {
|
||||
* ctx.drawImage(image, 0, 0)
|
||||
* }
|
||||
* }, [ref, image])
|
||||
*
|
||||
* return (
|
||||
* <>
|
||||
* {error && "there was a problem loading the image"}
|
||||
* <canvas ref={ref} />
|
||||
* </>
|
||||
* ```
|
||||
*/
|
||||
export default function useImage(imageOrUrl?: string | HTMLImageElement | null | undefined, crossOrigin?: 'anonymous' | 'use-credentials' | string): State;
|
||||
export {};
|
||||
Reference in New Issue
Block a user