The best way to control Claude Code, Codex and more from any computer or phone

main
ts 19 lines 752 Bytes
Raw
1 import type { FileBackedComposerAttachment } from "./composerImages";
2 import { retainComposerAttachmentFile } from "./composerAttachmentFiles";
3
4 /** State owns files but cannot be imported here; it registers cleanup when draft owners load. */
5 type UnusedAttachmentHandler = (attachment: FileBackedComposerAttachment) => void;
6
7 let onAttachmentUnused: UnusedAttachmentHandler | null = null;
8
9 export function registerComposerAttachmentUnusedHandler(handler: UnusedAttachmentHandler): void {
10 onAttachmentUnused = handler;
11 }
12
13 export function retainComposerAttachmentFileForPreview(
14 attachment: FileBackedComposerAttachment,
15 ): () => void {
16 return retainComposerAttachmentFile(attachment.fileUri, () => {
17 onAttachmentUnused?.(attachment);
18 });
19 }