mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 19:13:54 +00:00
Use common utility function to get img from url
This commit is contained in:
parent
2dca07ff0a
commit
fe00036cbf
1 changed files with 1 additions and 10 deletions
|
|
@ -31,16 +31,7 @@ export async function getFileFromZip(
|
|||
}
|
||||
|
||||
function fallbackGetImgFromBlob(blob: Blob): Promise<HTMLImageElement> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const img = new Image();
|
||||
img.onload = () => {
|
||||
// Schedule cleanup of object url?
|
||||
// Maybe on next tick, or with requestidlecallback
|
||||
resolve(img);
|
||||
};
|
||||
img.onerror = () => reject("Failed to decode image");
|
||||
img.src = URL.createObjectURL(blob);
|
||||
});
|
||||
return Utils.imgFromUrl(URL.createObjectURL(blob));
|
||||
}
|
||||
|
||||
export function getImgFromBlob(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue