MCPcopy
hub / github.com/ZToolsCenter/ZTools / handleClearHistory

Function handleClearHistory

src/main/api/renderer/systemCommands.ts:236–255  ·  view source on GitHub ↗
(ctx: SystemCommandContext)

Source from the content-addressed store, hash-verified

234}
235
236function handleClearHistory(ctx: SystemCommandContext): any {
237 console.log('[SystemCmd] 执行清除使用记录')
238 try {
239 // 清空历史记录
240 databaseAPI.dbPut('command-history', [])
241
242 // 通知渲染进程刷新历史记录
243 ctx.mainWindow?.webContents.send('history-changed')
244
245 // 触发 app-launched 事件(隐藏窗口)
246 ctx.mainWindow?.webContents.send('app-launched')
247 ctx.mainWindow?.hide()
248
249 console.log('[SystemCmd] 使用记录已清除')
250 return { success: true }
251 } catch (error) {
252 console.error('[SystemCmd] 清除使用记录失败:', error)
253 return { success: false, error: String(error) }
254 }
255}
256
257async function handleWebSearch(
258 ctx: SystemCommandContext,

Callers 1

executeSystemCommandFunction · 0.85

Calls 2

hideMethod · 0.80
dbPutMethod · 0.45

Tested by

no test coverage detected