chore: cleanup typings/internal-electron.d.ts (#25711)
This commit is contained in:
parent
17c7c5cfdd
commit
8df4faa8f0
6 changed files with 25 additions and 76 deletions
|
@ -14,13 +14,11 @@ export const handleSync = function <T extends IPCHandler> (channel: string, hand
|
|||
|
||||
let nextId = 0;
|
||||
|
||||
export function invokeInWebContents<T> (sender: Electron.WebContentsInternal, sendToAll: boolean, command: string, ...args: any[]) {
|
||||
export function invokeInWebContents<T> (sender: Electron.WebContents, sendToAll: boolean, command: string, ...args: any[]) {
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
const requestId = ++nextId;
|
||||
const channel = `${command}_RESPONSE_${requestId}`;
|
||||
ipcMainInternal.on(channel, function handler (
|
||||
event, error: Electron.SerializedError, result: any
|
||||
) {
|
||||
ipcMainInternal.on(channel, function handler (event, error: Error, result: any) {
|
||||
if (event.sender !== sender) {
|
||||
console.error(`Reply to ${command} sent by unexpected WebContents (${event.sender.id})`);
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue