import { ImageLoader } from "three";

let loader = new ImageLoader();
export async function LoadImageFromUrl(url: string): Promise<HTMLImageElement>
{
    return new Promise<HTMLImageElement>(async (res, rej) =>
    {
        if (!globalThis.document)
        {
            res(undefined);
            return;
        };

        loader.load(url,
            img => res(img), e => { },
            err => res(undefined)
        );
    });
}