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

@ -57,57 +57,6 @@ declare namespace Electron {
_getPreloadPaths(): string[];
equal(other: WebContents): boolean;
_initiallyShown: boolean;
}
interface WebPreferences {
guestInstanceId?: number;
openerId?: number;
}
interface SerializedError {
message: string;
stack?: string,
name: string,
from: Electron.ProcessType,
cause: SerializedError,
__ELECTRON_SERIALIZED_ERROR__: true
}
interface ErrorWithCause extends Error {
from?: string;
cause?: ErrorWithCause;
}
interface InjectionBase {
url: string;
code: string
}
interface ContentScript {
js: Array<InjectionBase>;
css: Array<InjectionBase>;
runAt: string;
matches: {
some: (input: (pattern: string) => boolean | RegExpMatchArray | null) => boolean;
}
/**
* Whether to match all frames, or only the top one.
* https://developer.chrome.com/extensions/content_scripts#frames
*/
allFrames: boolean
}
type ContentScriptEntry = {
extensionId: string;
contentScripts: ContentScript[];
}
interface IpcRendererInternal extends Electron.IpcRenderer {
invoke<T>(channel: string, ...args: any[]): Promise<T>;
sendToAll(webContentsId: number, channel: string, ...args: any[]): void
}
interface WebContentsInternal extends Electron.WebContents {
_send(internal: boolean, sendToAll: boolean, channel: string, args: any): boolean;
_sendToFrame(internal: boolean, sendToAll: boolean, frameId: number, channel: string, args: any): boolean;
_sendToFrameInternal(frameId: number, channel: string, args: any): boolean;
@ -123,6 +72,16 @@ declare namespace Electron {
length(): number;
}
interface WebFrame {
getWebFrameId(window: Window): number;
allowGuestViewElementDefinition(window: Window, context: any): void;
}
interface WebPreferences {
guestInstanceId?: number;
openerId?: number;
}
interface Menu {
_init(): void;
_isCommandIdChecked(id: string): boolean;
@ -169,7 +128,7 @@ declare namespace Electron {
}
class View {}
// Experimental views API
class BaseWindow {
constructor(args: {show: boolean})
@ -244,11 +203,9 @@ declare namespace ElectronInternal {
appIcon: Electron.NativeImage | null;
}
interface KeyWeakMap<K, V> {
set(key: K, value: V): void;
get(key: K): V | undefined;
has(key: K): boolean;
remove(key: K): void;
interface IpcRendererInternal extends Electron.IpcRenderer {
invoke<T>(channel: string, ...args: any[]): Promise<T>;
sendToAll(webContentsId: number, channel: string, ...args: any[]): void
}
// Internal IPC has _replyInternal and NO reply method
@ -270,11 +227,6 @@ declare namespace ElectronInternal {
loader: ModuleLoader;
}
interface WebFrameInternal extends Electron.WebFrame {
getWebFrameId(window: Window): number;
allowGuestViewElementDefinition(window: Window, context: any): void;
}
interface WebFrameResizeEvent extends Electron.Event {
newWidth: number;
newHeight: number;