electron-ipc-module
    Preparing search index...

    Interface DefineIpcModuleOptions<TChannels>

    interface DefineIpcModuleOptions<
        TChannels extends
            Record<string, ChannelDef> = Record<string, ChannelDef>,
    > {
        authorize?: (
            event: IpcMainEvent | IpcMainInvokeEvent,
            context: IpcChannelContext,
        ) => MaybePromise<boolean | void>;
        eventPrefix?: string | boolean;
        onListenerError?: (
            error: unknown,
            context: IpcChannelContext,
            event: IpcMainEvent,
        ) => void;
        ready?: (ipc: IpcMain) => MaybePromise<void | IpcModuleCleanup>;
        validate?: {
            [K in string | number | symbol]?: IpcChannelValidator<
                ChannelArgs<TChannels[K]>,
            >
        };
    }

    Type Parameters

    Index
    authorize?: (
        event: IpcMainEvent | IpcMainInvokeEvent,
        context: IpcChannelContext,
    ) => MaybePromise<boolean | void>

    Return false to reject calls from an untrusted renderer or frame.

    eventPrefix?: string | boolean

    Prefix emitted renderer event channels with the module prefix or a custom prefix.

    onListenerError?: (
        error: unknown,
        context: IpcChannelContext,
        event: IpcMainEvent,
    ) => void

    Called when a fire-and-forget listen / listenOnce channel rejects. Unlike handle channels, listener failures are not returned to the renderer — without this hook they are logged to avoid unhandled rejections.

    ready?: (ipc: IpcMain) => MaybePromise<void | IpcModuleCleanup>

    Hook run after every channel is registered. May return a cleanup callback that runs when the module is unloaded. If it throws, all channels registered so far are rolled back before the error propagates.

    validate?: {
        [K in string | number | symbol]?: IpcChannelValidator<
            ChannelArgs<TChannels[K]>,
        >
    }

    Per-channel runtime payload validators, keyed by channel key. A callback validator throws to reject; a Standard Schema validator rejects with IpcValidationError and its parsed output replaces the arguments.

    Keys are checked against the declared channels, so a misspelled entry is a compile error instead of a guard that silently never runs.