()
| 69 | } |
| 70 | |
| 71 | public async destroy(): Promise<void> { |
| 72 | if (!this.isInitialized) { |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | try { |
| 77 | this.log('销毁工具组件...'); |
| 78 | |
| 79 | if (this.toolManager) { |
| 80 | this.toolManager.removeAllListeners(); |
| 81 | } |
| 82 | |
| 83 | this.eventEmitter.removeAllListeners(); |
| 84 | this.isInitialized = false; |
| 85 | this.log('工具组件已销毁'); |
| 86 | } catch (error) { |
| 87 | this.error('工具组件销毁失败', error); |
| 88 | throw error; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * 获取工具管理器 |