build: convert touch-bar to typescript (#24511)

This commit is contained in:
Samuel Attard 2020-07-16 11:37:38 -07:00 committed by GitHub
parent 3f37ff87d2
commit 4c3da359fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 491 additions and 366 deletions

View file

@ -19,6 +19,17 @@ declare namespace Electron {
setAppPath(path: string | null): void;
}
type TouchBarItemType = NonNullable<Electron.TouchBarConstructorOptions['items']>[0];
interface BrowserWindow {
_touchBar: Electron.TouchBar | null;
_setTouchBarItems: (items: TouchBarItemType[]) => void;
_setEscapeTouchBarItem: (item: TouchBarItemType | {}) => void;
_refreshTouchBarItem: (itemID: string) => void;
on(event: '-touch-bar-interaction', listener: (event: Event, itemID: string, details: any) => void): this;
removeListener(event: '-touch-bar-interaction', listener: (event: Event, itemID: string, details: any) => void): this;
}
interface ContextBridge {
internalContextBridge: {
contextIsolationEnabled: boolean;
@ -29,6 +40,10 @@ declare namespace Electron {
}
}
interface TouchBar {
_removeFromWindow: (win: BrowserWindow) => void;
}
interface WebContents {
_getURL(): string;
_loadURL(url: string, options: Electron.LoadURLOptions): void;