chore: cleanup typings/internal-electron.d.ts (#25711)

This commit is contained in:
Milan Burda 2020-10-02 04:52:29 +02:00 committed by GitHub
parent 17c7c5cfdd
commit 8df4faa8f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 76 deletions

View file

@ -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;