Factored out ipcRenderer.on

Summary:
Delegate receiving events from the Electron host process to the RenderHost interface.

Typed them as well while at it.

Reviewed By: timur-valiev

Differential Revision: D31828130

fbshipit-source-id: 920055de6f48512b91a433b229dbacd611c6f139
This commit is contained in:
Michel Weststrate
2021-10-22 09:20:14 -07:00
committed by Facebook GitHub Bot
parent cc946d12ec
commit ecf2e32722
6 changed files with 70 additions and 37 deletions

View File

@@ -297,5 +297,10 @@ function initializeFlipperForElectron() {
hasFocus() {
return remote.getCurrentWindow().isFocused();
},
onIpcEvent(event, callback) {
ipcRenderer.on(event, (_ev, ...args: any[]) => {
callback(...(args as any));
});
},
});
}