parent
a6f7c7690d
commit
71fb19ea14
9 changed files with 288 additions and 715 deletions
|
@ -19,14 +19,14 @@ export class IpcMainImpl extends EventEmitter {
|
|||
throw new Error(`Expected handler to be a function, but found type '${typeof fn}'`);
|
||||
}
|
||||
this._invokeHandlers.set(method, fn);
|
||||
}
|
||||
};
|
||||
|
||||
handleOnce: Electron.IpcMain['handleOnce'] = (method, fn) => {
|
||||
this.handle(method, (e, ...args) => {
|
||||
this.removeHandler(method);
|
||||
return fn(e, ...args);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
removeHandler (method: string) {
|
||||
this._invokeHandlers.delete(method);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue