chore: tsify browser-window (#24326)

* chore: tsify browser-window

* fix focus

* also tsify top-level-window
This commit is contained in:
Jeremy Rose 2020-06-28 18:22:55 -07:00 committed by GitHub
parent 1c49e4e376
commit 80e5007c47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 227 additions and 194 deletions

View file

@ -34,6 +34,7 @@ declare namespace Electron {
getOwnerBrowserWindow(): Electron.BrowserWindow;
getLastWebPreferences(): Electron.WebPreferences;
_getPreloadPaths(): string[];
equal(other: WebContents): boolean;
}
interface WebPreferences {
@ -96,6 +97,41 @@ declare namespace Electron {
}
class View {}
// Experimental views API
class TopLevelWindow {
constructor(args: {show: boolean})
setContentView(view: View): void
static fromId(id: number): TopLevelWindow;
static getAllWindows(): TopLevelWindow[];
isFocused(): boolean;
static getFocusedWindow(): TopLevelWindow | undefined;
}
class WebContentsView {
constructor(options: BrowserWindowConstructorOptions)
}
// Deprecated / undocumented BrowserWindow methods
interface BrowserWindow {
getURL(): string;
send(channel: string, ...args: any[]): void;
openDevTools(options?: Electron.OpenDevToolsOptions): void;
closeDevTools(): void;
isDevToolsOpened(): void;
isDevToolsFocused(): void;
toggleDevTools(): void;
inspectElement(x: number, y: number): void;
inspectSharedWorker(): void;
inspectServiceWorker(): void;
getBackgroundThrottling(): void;
setBackgroundThrottling(allowed: boolean): void;
}
namespace Main {
class TopLevelWindow extends Electron.TopLevelWindow {}
class View extends Electron.View {}
class WebContentsView extends Electron.WebContentsView {}
}
}
declare namespace ElectronInternal {