refactor: Split 'Event' docs/types into more specific Event types (#17038)
* Event = Base event type (with preventDefault) * IpcMainEvent = Event that ipcMain emits (with sender, reply, etc.) * IpcRendererEvent = Event that ipcRenderer emits (with sender, senderId, etc.) * KeyboardEvent = Event that we emit with keyboard flags (ctrlKey, altKey, etc.) This will dramatically improve peoples TS experience with IPC events
This commit is contained in:
parent
ef2e7d95fe
commit
3b74837020
22 changed files with 515 additions and 285 deletions
|
@ -11,7 +11,7 @@ type WebFrameMethod = {
|
|||
export const webFrameInit = () => {
|
||||
// Call webFrame method
|
||||
ipcRendererInternal.on('ELECTRON_INTERNAL_RENDERER_WEB_FRAME_METHOD', (
|
||||
_event: Electron.Event, method: keyof WebFrameMethod, args: any[]
|
||||
_event, method: keyof WebFrameMethod, args: any[]
|
||||
) => {
|
||||
// The TypeScript compiler cannot handle the sheer number of
|
||||
// call signatures here and simply gives up. Incorrect invocations
|
||||
|
@ -20,7 +20,7 @@ export const webFrameInit = () => {
|
|||
})
|
||||
|
||||
ipcRendererInternal.on('ELECTRON_INTERNAL_RENDERER_ASYNC_WEB_FRAME_METHOD', (
|
||||
event: Electron.Event, requestId: number, method: keyof WebFrameMethod, args: any[]
|
||||
event, requestId: number, method: keyof WebFrameMethod, args: any[]
|
||||
) => {
|
||||
new Promise(resolve =>
|
||||
// The TypeScript compiler cannot handle the sheer number of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue