MCPcopy Create free account
hub / github.com/editablejs/editable / readImageElement

Function readImageElement

packages/plugins/image/src/utils.ts:42–54  ·  view source on GitHub ↗
(url: string, base64 = false)

Source from the content-addressed store, hash-verified

40}
41
42export 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
56interface ReadImageFileInfo {
57 url: string

Callers 3

withImageFunction · 0.90
image.tsxFile · 0.90
readImageFileInfoFunction · 0.85

Calls 1

readBase64Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…