* 通知渲染进程插件列表已变化(带防抖处理) * 如果3秒内没有新的通知请求,才会真正发送通知
()
| 210 | * 如果3秒内没有新的通知请求,才会真正发送通知 |
| 211 | */ |
| 212 | private notifyPluginsChanged(): void { |
| 213 | // 如果已有定时器在运行,清除它 |
| 214 | if (this.notifyTimer) { |
| 215 | clearTimeout(this.notifyTimer) |
| 216 | this.notifyTimer = null |
| 217 | } |
| 218 | |
| 219 | // 设置新的定时器,3秒后执行实际通知 |
| 220 | this.notifyTimer = setTimeout(() => { |
| 221 | const mainWindow = windowManager.getMainWindow() |
| 222 | if (mainWindow) { |
| 223 | mainWindow.webContents.send('plugins-changed') |
| 224 | } |
| 225 | this.notifyTimer = null |
| 226 | }, this.NOTIFY_DEBOUNCE_DELAY) |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * 清理插件的动态 features |