(plugin: TaskNotesPlugin)
| 34 | } |
| 35 | |
| 36 | export async function cleanupPluginRuntime(plugin: TaskNotesPlugin): Promise<void> { |
| 37 | if (plugin.settings?.enableBases) { |
| 38 | try { |
| 39 | unregisterBasesViews(plugin); |
| 40 | plugin.basesRegistered = false; |
| 41 | } catch (error) { |
| 42 | tasknotesLogger.debug("[TaskNotes][Bases] Unregistration failed:", { |
| 43 | category: "internal", |
| 44 | operation: "unregistration", |
| 45 | error: error, |
| 46 | }); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | const cacheStats = perfMonitor.getStats("cache-initialization"); |
| 51 | if (cacheStats && cacheStats.count > 0) { |
| 52 | perfMonitor.logSummary(); |
| 53 | } |
| 54 | |
| 55 | plugin.pomodoroService?.cleanup(); |
| 56 | plugin.filterService?.cleanup(); |
| 57 | plugin.viewPerformanceService?.destroy(); |
| 58 | |
| 59 | if (plugin.taskCardReadingModeCleanup) { |
| 60 | plugin.taskCardReadingModeCleanup(); |
| 61 | plugin.taskCardReadingModeCleanup = null; |
| 62 | } |
| 63 | |
| 64 | if (plugin.relationshipsReadingModeCleanup) { |
| 65 | plugin.relationshipsReadingModeCleanup(); |
| 66 | plugin.relationshipsReadingModeCleanup = null; |
| 67 | } |
| 68 | |
| 69 | plugin.autoArchiveService?.stop(); |
| 70 | plugin.icsSubscriptionService?.destroy(); |
| 71 | plugin.autoExportService?.destroy(); |
| 72 | plugin.taskLinkDetectionService?.cleanup(); |
| 73 | plugin.dragDropManager?.destroy(); |
| 74 | void plugin.apiService?.stop(); |
| 75 | void plugin.oauthService?.destroy(); |
| 76 | plugin.taskFileLifecycleReconciliationService?.destroy(); |
| 77 | plugin.taskCalendarSyncService?.destroy(); |
| 78 | plugin.googleCalendarService?.destroy(); |
| 79 | plugin.microsoftCalendarService?.destroy(); |
| 80 | plugin.calendarProviderRegistry?.destroyAll(); |
| 81 | plugin.viewStateManager?.cleanup(); |
| 82 | plugin.statusBarService?.destroy(); |
| 83 | plugin.notificationService?.destroy(); |
| 84 | plugin.projectSubtasksService?.destroy(); |
| 85 | plugin.cacheManager?.destroy(); |
| 86 | plugin.dependencyCache?.destroy(); |
| 87 | plugin.requestDeduplicator?.cancelAll(); |
| 88 | plugin.domReconciler?.destroy(); |
| 89 | plugin.uiStateManager?.destroy(); |
| 90 | plugin.settingsLifecycleService?.destroy(); |
| 91 | plugin.performanceProfiler?.destroy(); |
| 92 | |
| 93 | if (typeof perfMonitor !== "undefined") { |
no test coverage detected