handle MethodStatic @beta

Establish a handler for an Ipc channel to receive IpcHost.invoke calls

handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction

@returns A function to call to remove the handler.

@note If handler throws, or its returned Promise rejects, the thrown value is serialized (see serializeIpcError) and sent as the response instead of being rethrown here. Without this, the corresponding IpcHost.invoke call on the backend would never receive a reply and would hang (leaking its listener and _pendingInvokes entry) until IpcHost.shutdown is called.

Parameter Type Description
channel string The name of the channel for this handler.
handler (...args: any[]) => Promise<any> A function that supplies the implementation for channel

Returns - RemoveFunction

A function to call to remove the handler.

Defined in

Last Updated: 03 August, 2026