Files
electron/lib/renderer/ipc-renderer-internal.ts
Sam Attard b84ffddc3a chore: apply oxfmt formatting to JS and TS sources
Runs `yarn format` across lib/, spec/, script/, build/, default_app/,
and npm/ to bring the codebase in line with the .oxfmtrc.json settings
added in the previous commit. This is a pure formatting pass: import
statements are sorted into the groups defined by the config, method
chains longer than printWidth are broken, single-quoted strings
containing apostrophes are switched to double quotes, and a handful of
single-statement `if` bodies are re-wrapped and get braces added by
`oxlint --fix` to satisfy the `curly: multi-line` rule.

No behavior changes.
2026-04-06 16:17:00 +00:00

27 lines
788 B
TypeScript

import { getIPCRenderer } from '@electron/internal/renderer/ipc-renderer-bindings';
import { EventEmitter } from 'events';
const ipc = getIPCRenderer();
const internal = true;
class IpcRendererInternal extends EventEmitter implements ElectronInternal.IpcRendererInternal {
send(channel: string, ...args: any[]) {
return ipc.send(internal, channel, args);
}
sendSync(channel: string, ...args: any[]) {
return ipc.sendSync(internal, channel, args);
}
async invoke<T>(channel: string, ...args: any[]) {
const { error, result } = await ipc.invoke<T>(internal, channel, args);
if (error) {
throw new Error(`Error invoking remote method '${channel}': ${error}`);
}
return result;
}
}
export const ipcRendererInternal = new IpcRendererInternal();