MCPcopy Create free account
hub / github.com/StepfenShawn/ShitCodify / copyToClipboard

Function copyToClipboard

src/utils/promptGenerator.ts:204–219  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

202
203// 辅助函数:复制文本到剪贴板
204export function copyToClipboard(text: string): Promise<boolean> {
205 // 使用回调方式处理 Promise,避免使用 async/await
206 return new Promise<boolean>((resolve) => {
207 try {
208 navigator.clipboard.writeText(text)
209 .then(() => resolve(true))
210 .catch((err) => {
211 console.error('Failed to copy text: ', err);
212 resolve(false);
213 });
214 } catch (err) {
215 console.error('Failed to copy text: ', err);
216 resolve(false);
217 }
218 });
219}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected