MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / notifyPluginsChanged

Method notifyPluginsChanged

src/main/api/plugin/feature.ts:212–227  ·  view source on GitHub ↗

* 通知渲染进程插件列表已变化(带防抖处理) * 如果3秒内没有新的通知请求,才会真正发送通知

()

Source from the content-addressed store, hash-verified

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

Callers 1

setupIPCMethod · 0.95

Calls 1

getMainWindowMethod · 0.80

Tested by

no test coverage detected