Function loadImage

  • Load an image

    Parameters

    • source: string | HTMLImageElement
    • Optional props: TLoadImageProps

    Returns PCancelable<HTMLImageElement>

    Example

    const loaderWithoutCache = loadImage('/image.jpg');

    loaderWithoutCache.then((img) => console.log(img)).catch(() => {});

    const loaderWithCache = loadImage('/image.jpg', {
    crossOrigin: 'anonymous',
    useCache: true,
    });