(url: string, base64 = false)
| 40 | } |
| 41 | |
| 42 | export const readImageElement = (url: string, base64 = false) => { |
| 43 | return new Promise<HTMLImageElement>(async (resolve, reject) => { |
| 44 | if (base64) url = await readBase64(url) |
| 45 | const image = new window.Image() |
| 46 | image.onload = () => { |
| 47 | resolve(image) |
| 48 | } |
| 49 | image.onerror = () => { |
| 50 | reject('image load error') |
| 51 | } |
| 52 | image.src = url |
| 53 | }) |
| 54 | } |
| 55 | |
| 56 | interface ReadImageFileInfo { |
| 57 | url: string |
no test coverage detected
searching dependent graphs…