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:
3 files changed
+29
-66
No files matched your search
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user