MCPcopy Create free account
hub / github.com/027xiguapi/code-box / downloadImages

Function downloadImages

contents/custom.tsx:76–96  ·  view source on GitHub ↗
(
    onProgress?: (current: number, total: number) => void
  )

Source from the content-addressed store, hash-verified

74 })
75
76 async function downloadImages(
77 onProgress?: (current: number, total: number) => void
78 ) {
79 const imageUrls = Array.from(document.images).map((img) => img.src)
80 try {
81 const res = await sendToBackground({
82 name: "download",
83 body: {
84 action: "downloadAllImages",
85 imageUrls: imageUrls,
86 title: articleTitle,
87 onProgress: onProgress
88 }
89 })
90 if (res.code == 0) {
91 alert(i18n("downloadFailed"))
92 }
93 } catch (error) {
94 console.error(`Failed to download images:`, error)
95 }
96 }
97
98 return <CustomDomSelector />
99}

Callers 1

CustomOverlayFunction · 0.70

Calls 1

i18nFunction · 0.85

Tested by

no test coverage detected