Enhances cleanup with async lifecycle handling

Updates plugin cleanup to utilize async handlers during onunload,
ensuring proper resource management and cleanup of temporary files.
Removes redundant process termination listeners and integrates lifecycle
methods for better maintainability and efficiency.

Improves robustness of plugin cleanup on unload.
This commit is contained in:
AlexKucera committed 2025-11-08 18:32:48 +01:00
1 parent f0daebc8fd
commit 2e8ac6a848
3 files changed
+29 -66

No files matched your search

+7 -4
View File
@@ -236,11 +236,14 @@ export class obsidianTypstPDFExport extends Plugin {
throw error; // Re-throw to let callers handle appropriately
}
}
onunload() {
// Obsidian supports async onunload and will await it properly, even though
// the Plugin type definition shows void return. This ensures cleanup completes.
// eslint-disable-next-line @typescript-eslint/no-misused-promises
async onunload(): Promise<void> {
// Use lifecycle manager for cleanup
this.lifecycle.cleanup();
await this.lifecycle.cleanup();
}
}