mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 00:29:37 +08:00
16 lines
374 B
TypeScript
16 lines
374 B
TypeScript
/** Keep a composer draft if its session language could not be saved. */
|
|
export async function waitForReplyLanguageSave(
|
|
pending: Promise<void> | null,
|
|
content: string,
|
|
restoreDraft: (content: string) => void,
|
|
): Promise<boolean> {
|
|
if (!pending) return true;
|
|
try {
|
|
await pending;
|
|
return true;
|
|
} catch {
|
|
restoreDraft(content);
|
|
return false;
|
|
}
|
|
}
|