2018-06-17 21:59:48 +00:00
|
|
|
import {EventEmitter} from 'events';
|
|
|
|
|
2018-09-01 03:12:55 +00:00
|
|
|
declare class ElectronTabs extends EventEmitter {
|
2018-06-17 21:59:48 +00:00
|
|
|
constructor(options?: ElectronTabs.TabGroupOptions);
|
|
|
|
addTab(options?: ElectronTabs.TabOptions): ElectronTabs.Tab;
|
2018-11-27 11:28:48 +00:00
|
|
|
getTab(id: number): ElectronTabs.Tab | null;
|
2018-06-17 21:59:48 +00:00
|
|
|
getTabByPosition(position: number): ElectronTabs.Tab | null;
|
|
|
|
getTabByRelPosition(position: number): ElectronTabs.Tab | null;
|
|
|
|
getActiveTab(): ElectronTabs.Tab | null;
|
|
|
|
getTabs(): ElectronTabs.Tab[];
|
|
|
|
eachTab<T extends object>(
|
|
|
|
fn: (this: T, currentTab: ElectronTabs.Tab, index: number, tabs: ElectronTabs.Tab[]) => void,
|
|
|
|
thisArg?: T,
|
|
|
|
): void;
|
|
|
|
tabContainer: HTMLElement;
|
|
|
|
}
|
|
|
|
|
2018-09-01 03:12:55 +00:00
|
|
|
declare namespace ElectronTabs {
|
2018-06-17 21:59:48 +00:00
|
|
|
export interface TabGroupOptions {
|
|
|
|
tabContainerSelector?: string;
|
|
|
|
buttonsContainerSelector?: string;
|
|
|
|
viewContainerSelector?: string;
|
|
|
|
tabClass?: string;
|
|
|
|
viewClass?: string;
|
|
|
|
closeButtonText?: string;
|
|
|
|
newTabButtonText?: string;
|
|
|
|
newTab?: TabOptions | (() => TabOptions);
|
|
|
|
ready?: (tabGroup: ElectronTabs) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface TabOptions {
|
|
|
|
title?: string;
|
|
|
|
src?: string;
|
|
|
|
badge?: string;
|
|
|
|
iconURL?: string;
|
|
|
|
icon?: string;
|
|
|
|
closable?: boolean;
|
|
|
|
webviewAttributes?: {[key: string]: any};
|
|
|
|
visible?: boolean;
|
|
|
|
active?: boolean;
|
|
|
|
ready?: (tab: Tab) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Tab extends EventEmitter {
|
2018-11-23 12:20:53 +00:00
|
|
|
id: number;
|
2018-06-17 21:59:48 +00:00
|
|
|
setTitle(title: string): void;
|
|
|
|
getTitle(): string;
|
|
|
|
setBadge(badge: string): void;
|
|
|
|
getBadge(): string;
|
|
|
|
setIcon(iconURL?: string, icon?: undefined | null): void;
|
|
|
|
setIcon(iconURL: undefined | null, icon: string): void;
|
|
|
|
getIcon(): string;
|
|
|
|
setPosition(position: number): Tab | null;
|
|
|
|
getPosition(fromRight?: boolean): number;
|
|
|
|
activate(): void;
|
|
|
|
show(shown?: boolean): void;
|
|
|
|
hide(): void;
|
|
|
|
flash(shown?: boolean): void;
|
|
|
|
unflash(): void;
|
|
|
|
close(force?: boolean): void;
|
2022-03-06 04:54:03 +00:00
|
|
|
webview: Electron.WebviewTag;
|
2018-06-17 21:59:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export = ElectronTabs;
|