* Cleanup when service is destroyed
()
| 497 | * Cleanup when service is destroyed |
| 498 | */ |
| 499 | destroy(): void { |
| 500 | if (this.updateTimeout) { |
| 501 | window.clearTimeout(this.updateTimeout); |
| 502 | this.updateTimeout = null; |
| 503 | } |
| 504 | if (this.pomodoroUpdateTimeout) { |
| 505 | window.clearTimeout(this.pomodoroUpdateTimeout); |
| 506 | this.pomodoroUpdateTimeout = null; |
| 507 | } |
| 508 | this.stopElapsedTicker(); |
| 509 | if (this.plugin.emitter?.offref) { |
| 510 | this.pomodoroEventRefs.forEach((ref) => this.plugin.emitter.offref(ref)); |
| 511 | } |
| 512 | this.pomodoroEventRefs = []; |
| 513 | |
| 514 | if (this.requestDeduplicator) { |
| 515 | this.requestDeduplicator.cancelAll(); |
| 516 | } |
| 517 | |
| 518 | // Status bar element is automatically cleaned up by Obsidian when plugin unloads |
| 519 | this.statusBarElement = null; |
| 520 | this.pomodoroStatusBarElement = null; |
| 521 | } |
| 522 | } |
nothing calls this directly
no test coverage detected