🐛 Fix(custom): remove listener before unmount

This commit is contained in:
Kuingsmile
2024-05-25 21:06:27 +08:00
parent c102ac5158
commit 8b21e8407c
5 changed files with 8 additions and 9 deletions

View File

@@ -57,7 +57,7 @@ export class GalleryDB implements IGalleryDB {
#msgHandler<T> (method: string, ...args: any[]): Promise<T> {
return new Promise((resolve) => {
const callbackId = uuid()
const callback = (event: IpcRendererEvent, data: T, returnCallbackId: string) => {
const callback = (_: IpcRendererEvent, data: T, returnCallbackId: string) => {
if (returnCallbackId === callbackId) {
resolve(data)
ipcRenderer.removeListener(method, callback)