import { ImageLoader } from "three";

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

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