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

Function batchDownload

component/items/batchDownload.tsx:10–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8 const [message, setMessage] = useState("")
9
10 async function batchDownload() {
11 if (loading) return
12
13 setLoading(true)
14 setMessage("正在批量下载...")
15
16 try {
17 const response = await sendToBackground({
18 name: "batchDownload",
19 body: {
20 action: "batchDownloadAllTabs"
21 }
22 })
23
24 if (response.code === 200) {
25 setMessage(response.msg || "下载成功")
26 setTimeout(() => setMessage(""), 3000)
27 } else {
28 setMessage(response.msg || "下载失败")
29 setTimeout(() => setMessage(""), 3000)
30 }
31 } catch (error) {
32 console.error("Batch download error:", error)
33 setMessage("下载失败: " + error.message)
34 setTimeout(() => setMessage(""), 3000)
35 } finally {
36 setLoading(false)
37 }
38 }
39
40 return (
41 <div className="item batch-download">

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected