From a043a60b89deda3b6342f08f9ad6b3de9d01a950 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Wed, 24 May 2023 20:01:07 +0200 Subject: [PATCH] refactor: cleanup global variable declarations (#38410) refactor: eliminate duplicate isolatedApi typing Co-authored-by: Milan Burda --- lib/isolated_renderer/init.ts | 5 +++-- lib/sandboxed_renderer/init.ts | 7 ++++++- typings/internal-ambient.d.ts | 10 ---------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/isolated_renderer/init.ts b/lib/isolated_renderer/init.ts index d2cbf4207fa9..30b8eec2468e 100644 --- a/lib/isolated_renderer/init.ts +++ b/lib/isolated_renderer/init.ts @@ -1,6 +1,7 @@ -/* global isolatedApi */ - import type * as webViewElementModule from '@electron/internal/renderer/web-view/web-view-element'; +import type { WebViewImplHooks } from '@electron/internal/renderer/web-view/web-view-impl'; + +declare const isolatedApi: WebViewImplHooks; if (isolatedApi.guestViewInternal) { // Must setup the WebView element in main world. diff --git a/lib/sandboxed_renderer/init.ts b/lib/sandboxed_renderer/init.ts index 079dd38b069e..9c07a198240a 100644 --- a/lib/sandboxed_renderer/init.ts +++ b/lib/sandboxed_renderer/init.ts @@ -1,10 +1,15 @@ -/* global binding */ import * as events from 'events'; import { IPC_MESSAGES } from '@electron/internal/common/ipc-messages'; import type * as ipcRendererUtilsModule from '@electron/internal/renderer/ipc-renderer-internal-utils'; import type * as ipcRendererInternalModule from '@electron/internal/renderer/ipc-renderer-internal'; +declare const binding: { + get: (name: string) => any; + process: NodeJS.Process; + createPreloadScript: (src: string) => Function +}; + const { EventEmitter } = events; process._linkedBinding = binding.get; diff --git a/typings/internal-ambient.d.ts b/typings/internal-ambient.d.ts index 805236ddd620..08764778047e 100644 --- a/typings/internal-ambient.d.ts +++ b/typings/internal-ambient.d.ts @@ -1,13 +1,3 @@ -/* eslint-disable no-var */ -declare var internalBinding: any; -declare var binding: { get: (name: string) => any; process: NodeJS.Process; createPreloadScript: (src: string) => Function }; - -declare var isolatedApi: { - guestViewInternal: any; - allowGuestViewElementDefinition: NodeJS.InternalWebFrame['allowGuestViewElementDefinition']; - setIsWebView: (iframe: HTMLIFrameElement) => void; -} - declare const BUILDFLAG: (flag: boolean) => boolean; declare const ENABLE_DESKTOP_CAPTURER: boolean;