// Generated by dts-bundle-generator v9.5.1
import type { Annotation, AnnotationType, ChangeDesc, ChangeSet, ChangeSpec, CharCategory, EditorSelection as CmEditorSelection, EditorState, EditorStateConfig, Extension, Facet, FacetReader, Line, Range as Range, RangeComparator, RangeCursor, RangeValue, SelectionRange, SpanIterator, StateEffect, StateEffectType, StateField, Text as Text, Transaction, TransactionSpec } from '@codemirror/state';
import type { EditorView, ViewUpdate, WidgetType } from '@codemirror/view';
import * as fs from 'node:fs';
import type { FSWatcher } from 'node:fs';
import * as fsPromises from 'node:fs/promises';
import * as path from 'node:path';
import type { AbstractTextComponent, App, BaseComponent, BasesConfigFileFilter, BasesEntry, BasesEntryGroup, BasesQueryResult, BasesViewConfig, BlockCache, BooleanValue, ButtonComponent, CacheItem, CachedMetadata, CapacitorAdapter, CliFlag, CliFlags, CliHandler, ColorComponent, Command, Component, DataAdapter, DateValue, Debouncer, DropdownComponent, DurationValue, EditableFileView, Editor, EditorPosition, EditorRange, EditorRangeOrCaret, EditorSelection, EditorSuggest, EmbedCache, EventRef, Events, ExtraButtonComponent, FileManager, FileStats, FileSystemAdapter, FileValue, FileView, FrontmatterLinkCache, FuzzySuggestModal, HTMLValue, HoverLinkSource, HoverParent, HoverPopover, IconName, IconValue, ImageValue, Instruction, ItemView, Keymap, KeymapInfo, LinkCache, LinkValue, ListValue, MarkdownEditView, MarkdownFileInfo, MarkdownPostProcessorContext, MarkdownPreviewRenderer, MarkdownPreviewView, MarkdownRenderChild, MarkdownRenderer, MarkdownView, Menu, MenuItem, MenuSeparator, MetadataCache, Modal, MomentFormatComponent, NotNullValue, Notice as Notice, NullValue, NumberValue, ObjectValue, PaneType, Plugin as Plugin, PluginManifest, PluginSettingTab, Point, PopoverSuggest, ProgressBarComponent, QueryController, Reference, ReferenceCache, RegExpValue, RelativeDateValue, RenderContext, Scope, SearchComponent, SearchResult, SecretComponent, SecretStorage, Setting, SettingGroup, SettingTab, SliderComponent, SplitDirection, StringValue, TAbstractFile, TFile, TFolder, TagValue, Tasks, TextAreaComponent, TextComponent, TextFileView, ToggleComponent, UrlValue, Value, ValueComponent, Vault, View, ViewCreator, ViewState, Workspace, WorkspaceContainer, WorkspaceFloating, WorkspaceItem, WorkspaceLeaf, WorkspaceMobileDrawer, WorkspaceParent, WorkspaceRibbon, WorkspaceRoot, WorkspaceSidedock, WorkspaceSplit, WorkspaceTabs, WorkspaceWindow, moment as momentInstance } from 'obsidian';
/**
* Converts HTML to Markdown.
*
* @public
* @unofficial
*/
declare class TurndownService {
/** Current conversion options. */
options: TurndownServiceOptions;
/** Collection of conversion rules. */
rules: TurndownServiceRules;
/**
* Create new instance of {@link TurndownService}.
*
* @param options - Options.
*/
constructor(options?: TurndownServiceOptions);
/**
* Add a conversion rule.
*
* @param key - Rule identifier.
* @param rule - The rule definition.
* @returns This instance for chaining.
*/
addRule(key: string, rule: TurndownServiceRule): this;
/**
* Escape a string for use in Markdown.
*
* @param str - The string to escape.
* @returns The escaped string.
*/
escape(str: string): string;
/**
* Keep elements matching a filter (pass through as HTML).
*
* @param filter - The filter to match.
* @returns This instance for chaining.
*/
keep(filter: TurndownServiceFilter): this;
/**
* Remove elements matching a filter from output.
*
* @param filter - The filter to match.
* @returns This instance for chaining.
*/
remove(filter: TurndownServiceFilter): this;
/**
* Convert HTML to Markdown.
*
* @param html - HTML string or DOM node to convert.
* @returns The Markdown string.
*/
turndown(html: string | TurndownServiceNode): string;
/**
* Register plugin(s).
*
* @param plugins - Plugin or array of plugins.
* @returns This instance for chaining.
*/
use(plugins: TurndownServicePlugin | TurndownServicePlugin[]): this;
}
/**
* Capacitor global instance.
*
* @public
* @unofficial
*/
declare const Capacitor: CapacitorGlobal;
/**
* Capacitor platforms instance.
*
* @deprecated Deprecated.
* @public
* @unofficial
*/
declare const CapacitorPlatforms: CapacitorPlatformsGlobal;
/**
* Electron app instance for managing the application lifecycle.
*
* @public
* @unofficial
*/
declare const app: ElectronApp;
/**
* Base class for all display objects.
*
* @public
* @unofficial
*/
export declare abstract class DisplayObject {
/** Alpha (opacity). */
alpha: number;
/** Rotation angle in degrees. */
angle: number;
/** Cursor style when hovering. */
cursor: null | string;
/** Hit area shape. */
hitArea: IHitArea | null;
/** Whether the object is interactive. */
interactive: boolean;
/** Display name. */
name: null | string;
/** Parent container. */
parent: Container;
/** Whether the object is renderable. */
renderable: boolean;
/** Rotation in radians. */
rotation: number;
/** Transform data. */
transform: Transform;
/** Whether the object is visible. */
visible: boolean;
/** Alpha relative to the scene. */
worldAlpha: number;
/** World transform matrix (read-only). */
readonly worldTransform: Matrix;
/** Whether the object is visible in the scene (read-only). */
readonly worldVisible: boolean;
/** X position. */
x: number;
/** Y position. */
y: number;
/** Z-index for sorting. */
zIndex: number;
/**
* Destroys this display object.
*
* @param options - Destroy options.
*/
destroy(options?: boolean | IDestroyOptions): void;
/**
* Emits an event.
*
* @param event - Event name.
* @param args - Arguments.
* @returns Whether any listeners were called.
*/
emit(event: string | symbol, ...args: unknown[]): boolean;
/**
* Returns the bounds of the object.
*
* @param skipUpdate - Whether to skip the update.
* @param rect - Rectangle to store bounds in.
* @returns The bounds rectangle.
*/
getBounds(skipUpdate?: boolean, rect?: PixiRectangle): PixiRectangle;
/**
* Returns the local bounds of the object.
*
* @param rect - Rectangle to store bounds in.
* @returns The local bounds rectangle.
*/
getLocalBounds(rect?: PixiRectangle): PixiRectangle;
/**
* Removes an event listener.
*
* @param event - Event name.
* @param fn - Callback function.
* @param context - Callback context.
* @returns This object for chaining.
*/
off(event: string | symbol, fn?: (...args: unknown[]) => void, context?: unknown): this;
/**
* Adds an event listener.
*
* @param event - Event name.
* @param fn - Callback function.
* @param context - Callback context.
* @returns This object for chaining.
*/
on(event: string | symbol, fn: (...args: unknown[]) => void, context?: unknown): this;
/**
* Adds a one-time event listener.
*
* @param event - Event name.
* @param fn - Callback function.
* @param context - Callback context.
* @returns This object for chaining.
*/
once(event: string | symbol, fn: (...args: unknown[]) => void, context?: unknown): this;
/** Pivot point. */
get pivot(): ObservablePoint;
// eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor.
set pivot(value: IPointData);
/** Position. */
get position(): ObservablePoint;
// eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor.
set position(value: IPointData);
/**
* Removes all listeners for the given event.
*
* @param event - Event name.
* @returns This object for chaining.
*/
removeAllListeners(event?: string | symbol): this;
/** Scale. */
get scale(): ObservablePoint;
// eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor.
set scale(value: IPointData);
/** Skew. */
get skew(): ObservablePoint;
// eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor.
set skew(value: IPointData);
/**
* Converts a point to global (screen) coordinates.
*
* @param position - The point to convert.
* @param point - Output point.
* @param skipUpdate - Whether to skip the update.
* @returns The global point.
*/
toGlobal
(position: IPointData, point?: P, skipUpdate?: boolean): P;
/**
* Converts a point to local coordinates.
*
* @param position - The point to convert.
* @param from - The display object to convert from.
* @param point - Output point.
* @param skipUpdate - Whether to skip the update.
* @returns The local point.
*/
toLocal
(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P;
}
/**
* Abstract base class for parsers.
*
* @public
* @unofficial
*/
export declare abstract class Parser {
/**
* Start a parse for the given input.
*
* @param input - The document input.
* @param fragments - Previously parsed fragments that can be reused.
* @param ranges - The ranges of the document to parse.
* @returns A partial parse that can be advanced.
*/
abstract createParse(input: Input, fragments: readonly LezerTreeFragment[], ranges: readonly LezerTreeRange[]): PartialParse;
/**
* Parse a document.
*
* @param input - The document input or string.
* @param fragments - Previously parsed fragments that can be reused.
* @param ranges - The ranges of the document to parse.
* @returns The parsed tree.
*/
parse(input: Input | string, fragments?: readonly LezerTreeFragment[], ranges?: readonly LezerTreeRange[]): LezerTree;
}
/**
* PixiJS application.
*
* @public
* @unofficial
*/
export declare class Application {
/** Renderer instance. */
renderer: IRenderer;
/** Root container of the scene graph. */
stage: Container;
/**
* Creates a new application.
*
* @param options - Application options.
*/
constructor(options?: Partial);
/**
* Destroys the application.
*
* @param removeView - Whether to remove the view from the DOM.
* @param stageOptions - Options for destroying the stage.
*/
destroy(removeView?: boolean, stageOptions?: boolean | IDestroyOptions): void;
/** Renders the application. */
render(): void;
/** Screen rectangle. */
get screen(): PixiRectangle;
/** Canvas view. */
get view(): VIEW;
}
/**
* Capacitor exception.
*
* @public
* @unofficial
*/
export declare class CapacitorException extends Error {
/** Exception code. */
readonly code?: string;
/** Exception data. */
readonly data?: unknown;
/** Exception message. */
readonly message: string;
/**
* Creates a new CapacitorException.
*
* @param message - Exception message.
* @param code - Exception code.
* @param data - Exception data.
*/
constructor(message: string, code?: string, data?: unknown);
}
/**
* The document data type used in CodeMirror.
*
* @public
* @unofficial
*/
export declare class CmText {
/** An empty document. */
static empty: CmText;
/** The length of the document. */
readonly length: number;
/** The number of lines in the document. */
readonly lines: number;
/**
* Get the line at a given 1-based line number.
*
* @param n - The 1-based line number.
* @returns The line.
*/
line(n: number): Line;
/**
* Get the line at the given position.
*
* @param pos - The position.
* @returns The line containing the position.
*/
lineAt(pos: number): Line;
/**
* Create a text from an array of lines.
*
* @param text - The lines to create the text from.
* @returns The created text.
*/
static of(text: readonly string[]): CmText;
/**
* Return the document as a string, using newline characters to separate lines.
*
* @param from - The start position.
* @param to - The end position.
* @param lineSep - The line separator to use.
* @returns The string content.
*/
sliceString(from: number, to?: number, lineSep?: string): string;
/**
* Return the document as a string.
*
* @returns The string content.
*/
toString(): string;
}
/**
* Container for display objects.
*
* @public
* @unofficial
*/
export declare class Container extends DisplayObject {
/** Children of this container (read-only). */
readonly children: T[];
/** Parent container. */
parent: Container;
/** Whether children should be sorted by zIndex. */
sortableChildren: boolean;
/** Whether the children need sorting. */
sortDirty: boolean;
/**
* Adds one or more children to the container.
*
* @param children - Children to add.
* @returns The first child added.
*/
addChild(...children: U): U[0];
/**
* Adds a child at a specific index.
*
* @param child - Child to add.
* @param index - Index to insert at.
* @returns The child added.
*/
addChildAt(child: U, index: number): U;
/**
* Destroys this container.
*
* @param options - Destroy options.
*/
destroy(options?: boolean | IDestroyOptions): void;
/**
* Returns the child at the given index.
*
* @param index - Index of the child.
* @returns The child at the index.
*/
getChildAt(index: number): T;
/**
* Returns the index of a child.
*
* @param child - The child to find.
* @returns The index of the child.
*/
getChildIndex(child: T): number;
/** Height of the container. */
get height(): number;
// eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor.
set height(value: number);
/**
* Removes one or more children from the container.
*
* @param children - Children to remove.
* @returns The first child removed.
*/
removeChild(...children: U): U[0];
/**
* Removes the child at a specific index.
*
* @param index - Index of the child to remove.
* @returns The removed child.
*/
removeChildAt(index: number): T;
/**
* Removes children from the container.
*
* @param beginIndex - Start index.
* @param endIndex - End index.
* @returns The removed children.
*/
removeChildren(beginIndex?: number, endIndex?: number): T[];
/**
* Sets the index of a child.
*
* @param child - The child.
* @param index - The new index.
*/
setChildIndex(child: T, index: number): void;
/** Sorts the children by zIndex. */
sortChildren(): void;
/** Width of the container. */
get width(): number;
// eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor.
set width(value: number);
}
/**
* A dictionary that maps string keys to arrays of unique values, implementing {@link CustomArrayDict}.
*
* @public
* @unofficial
*/
export declare class CustomArrayDictImpl implements CustomArrayDict {
/**
* Internal map storing key-to-array mappings.
*/
data: Map;
/**
* Add a value to the array associated with the given key.
*
* @param key - The key.
* @param value - The value to add.
*/
add(key: string, value: T): void;
/**
* Remove all values for the given key.
*
* @param key - The key to clear.
*/
clear(key: string): void;
/**
* Remove all keys and their values.
*/
clearAll(): void;
/**
* Check whether the array for the given key contains the specified value.
*
* @param key - The key.
* @param value - The value to check.
* @returns Whether the value exists.
*/
contains(key: string, value: T): boolean;
/**
* Get the total number of values across all keys.
*
* @returns Total value count.
*/
count(): number;
/**
* Get the array of values for the given key, or `null` if not found.
*
* @param key - The key.
* @returns Array of values, or `null`.
*/
get(key: string): null | T[];
/**
* Get all keys in the dictionary.
*
* @returns Array of keys.
*/
keys(): string[];
/**
* Remove a specific value from the array associated with the given key.
*
* @param key - The key.
* @param value - The value to remove.
*/
remove(key: string, value: T): void;
}
/**
* Electron BrowserView for embedding additional web content in a {@link ElectronBrowserWindow}.
*
* @public
* @unofficial
*/
export declare class ElectronBrowserView {
/** The web contents owned by this view. */
webContents: ElectronWebContents;
/**
* Create new instance of {@link ElectronBrowserView}.
*
* @param options - Options.
*/
constructor(options?: ElectronBrowserViewConstructorOptions);
/**
* Returns the bounds of this view.
*
* @returns The view bounds.
*/
getBounds(): ElectronRectangle;
/**
* Configures how the view auto-resizes with its window.
*
* @param options - The auto-resize options.
*/
setAutoResize(options: ElectronAutoResizeOptions): void;
/**
* Sets the background color of the view.
*
* @param color - The CSS color value.
*/
setBackgroundColor(color: string): void;
/**
* Resizes and moves the view to the supplied bounds relative to the window.
*
* @param bounds - The new bounds.
*/
setBounds(bounds: ElectronRectangle): void;
}
/**
* Electron BrowserWindow for creating and managing application windows.
*
* @public
* @unofficial
*/
export declare class ElectronBrowserWindow {
/**
* An alternative title provided only to accessibility tools such as screen readers. This string is not directly
* visible to users.
*/
accessibleTitle: string;
/** Whether the window menu bar should hide itself automatically. */
autoHideMenuBar: boolean;
/** Whether the window can be manually closed by user. On Linux the setter is a no-op. */
closable: boolean;
/** Whether the window's document has been edited (macOS only). */
documentEdited: boolean;
/** Whether the window is excluded from the application's Windows menu (macOS only). */
excludedFromShownWindowsMenu: boolean;
/** Whether the window is focusable (macOS and Windows). */
focusable: boolean;
/** Whether the window is in fullscreen mode. */
fullScreen: boolean;
/** Whether the maximize/zoom window button toggles fullscreen mode or maximizes the window. */
fullScreenable: boolean;
/** The unique identifier of the window, unique among all `BrowserWindow` instances of the entire application. */
readonly id: number;
/** Whether the window is in kiosk mode. */
kiosk: boolean;
/** Whether the window can be manually maximized by user. On Linux the setter is a no-op. */
maximizable: boolean;
/** Whether the menu bar should be visible (Windows and Linux). */
menuBarVisible: boolean;
/** Whether the window can be manually minimized by user. On Linux the setter is a no-op. */
minimizable: boolean;
/** Whether the window can be moved by user. On Linux the setter is a no-op. */
movable: boolean;
/** The pathname of the file the window represents (macOS only). */
representedFilename: string;
/** Whether the window can be manually resized by user. */
resizable: boolean;
/** Whether the window has a shadow. */
shadow: boolean;
/** Whether the window is in simple (pre-Lion) fullscreen mode. */
simpleFullScreen: boolean;
/** The title of the native window. */
title: string;
/** Whether the window is visible on all workspaces. Always returns `false` on Windows. */
visibleOnAllWorkspaces: boolean;
/** The web contents owned by this window. All web page related events and operations will be done via it. */
readonly webContents: ElectronWebContents;
/**
* Create new instance of {@link ElectronBrowserWindow}.
*
* @param options - Options.
*/
constructor(options?: BrowserWindowConstructorOptions);
/**
* Replacement API for `setBrowserView` supporting work with multi browser views.
*
* @param browserView - The view to add.
*/
addBrowserView(browserView: ElectronBrowserView): void;
/**
* Registers a listener for the given window event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This BrowserWindow instance.
*/
addListener(event: "always-on-top-changed", listener: (event: ElectronEvent, isAlwaysOnTop: boolean) => void): this;
/** */
addListener(event: "app-command", listener: (event: ElectronEvent, command: string) => void): this;
/** */
addListener(event: "blur", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "close", listener: (event: ElectronEvent) => void): this;
/** */
addListener(event: "closed", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "enter-full-screen", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "focus", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "hide", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "leave-full-screen", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "maximize", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "minimize", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "move", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "moved", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "new-window-for-tab", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this;
/** */
addListener(event: "ready-to-show", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "resize", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "resized", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "responsive", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "restore", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "rotate-gesture", listener: (event: ElectronEvent, rotation: number) => void): this;
/** */
addListener(event: "scroll-touch-begin", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "scroll-touch-edge", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "scroll-touch-end", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "session-end", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "sheet-begin", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "sheet-end", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "show", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "swipe", listener: (event: ElectronEvent, direction: string) => void): this;
/** */
addListener(event: "system-context-menu", listener: (event: ElectronEvent, point: ElectronPoint) => void): this;
/** */
addListener(event: "unmaximize", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "unresponsive", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "will-move", listener: (event: ElectronEvent, newBounds: ElectronRectangle) => void): this;
/** */
addListener(event: "will-resize", listener: (event: ElectronEvent, newBounds: ElectronRectangle, details: ElectronWillResizeDetails) => void): this;
/**
* Adds a window as a tab on this window, after the tab for the window instance (macOS only).
*
* @param browserWindow - The window to add as a tab.
*/
addTabbedWindow(browserWindow: ElectronBrowserWindow): void;
/** Removes focus from the window. */
blur(): void;
/** Removes focus from the web view. */
blurWebView(): void;
/**
* Captures a snapshot of the page within `rect`. Omitting `rect` will capture the whole visible page.
*
* @param rect - The bounds to capture.
* @returns A promise that resolves with the captured image.
*/
capturePage(rect?: ElectronRectangle): Promise;
/** Moves window to the center of the screen. */
center(): void;
/** Tries to close the window. This has the same effect as a user manually clicking the close button. */
close(): void;
/** Closes the currently open Quick Look panel (macOS only). */
closeFilePreview(): void;
/** Force-closes the window; the `unload` and `beforeunload` events won't be emitted, but `closed` is guaranteed. */
destroy(): void;
/**
* Starts or stops flashing the window to attract user's attention.
*
* @param flag - Whether to flash the window.
*/
flashFrame(flag: boolean): void;
/** Focuses on the window. */
focus(): void;
/** Focuses on the web view. */
focusOnWebView(): void;
/**
* Returns the window that owns the given `browserView`.
*
* @param browserView - The view to look up.
* @returns The owning BrowserWindow or `null` if the view is not attached to any window.
*/
static fromBrowserView(browserView: ElectronBrowserView): ElectronBrowserWindow | null;
/**
* Returns the window with the given `id`.
*
* @param id - The window id.
* @returns The BrowserWindow or `null` if not found.
*/
static fromId(id: number): ElectronBrowserWindow | null;
/**
* Returns the window that owns the given `webContents`.
*
* @param webContents - The web contents to look up.
* @returns The owning BrowserWindow or `null` if the contents are not owned by a window.
*/
static fromWebContents(webContents: ElectronWebContents): ElectronBrowserWindow | null;
/**
* Returns all opened browser windows.
*
* @returns An array of all BrowserWindow instances.
*/
static getAllWindows(): ElectronBrowserWindow[];
/**
* Returns the background color of the window in Hex (`#RRGGBB`) format.
*
* @returns The background color.
*/
getBackgroundColor(): string;
/**
* Returns the bounds of the window.
*
* @returns The window bounds.
*/
getBounds(): ElectronRectangle;
/**
* Returns the `BrowserView` attached to this window.
*
* @returns The attached view or `null` if one is not attached.
*/
getBrowserView(): ElectronBrowserView | null;
/**
* Returns all views attached with `addBrowserView` or `setBrowserView`.
*
* @returns An array of attached views.
*/
getBrowserViews(): ElectronBrowserView[];
/**
* Returns all child windows.
*
* @returns An array of child windows.
*/
getChildWindows(): ElectronBrowserWindow[];
/**
* Returns the bounds of the window's client area.
*
* @returns The content bounds.
*/
getContentBounds(): ElectronRectangle;
/**
* Returns the window's client area's width and height.
*
* @returns A tuple of `[width, height]`.
*/
getContentSize(): number[];
/**
* Returns the window that is focused in this application.
*
* @returns The focused BrowserWindow or `null` if none is focused.
*/
static getFocusedWindow(): ElectronBrowserWindow | null;
/**
* Returns the window's maximum width and height.
*
* @returns A tuple of `[width, height]`.
*/
getMaximumSize(): number[];
/**
* Returns the window id in the format of DesktopCapturerSource's id.
*
* @returns The media source id.
*/
getMediaSourceId(): string;
/**
* Returns the window's minimum width and height.
*
* @returns A tuple of `[width, height]`.
*/
getMinimumSize(): number[];
/**
* Returns the platform-specific handle of the window.
*
* @returns The native window handle buffer.
*/
getNativeWindowHandle(): Buffer;
/**
* Returns the window bounds of the normal state, regardless of the current window state.
*
* @returns The normal-state bounds.
*/
getNormalBounds(): ElectronRectangle;
/**
* Returns the opacity of the window, between `0.0` (fully transparent) and `1.0` (fully opaque). On Linux, always
* returns `1`.
*
* @returns The window opacity.
*/
getOpacity(): number;
/**
* Returns the parent window.
*
* @returns The parent window or `null` if there is no parent.
*/
getParentWindow(): ElectronBrowserWindow | null;
/**
* Returns the window's current position.
*
* @returns A tuple of `[x, y]` coordinates.
*/
getPosition(): number[];
/**
* Returns the pathname of the file the window represents (macOS only).
*
* @returns The represented filename.
*/
getRepresentedFilename(): string;
/**
* Returns the window's width and height.
*
* @returns A tuple of `[width, height]`.
*/
getSize(): number[];
/**
* Returns the title of the native window.
*
* @returns The window title.
*/
getTitle(): string;
/**
* Returns the custom position for the traffic light buttons in a frameless window (macOS only).
*
* @returns The traffic light position.
*/
getTrafficLightPosition(): ElectronPoint;
/**
* Returns whether the window has a shadow.
*
* @returns Whether the window has a shadow.
*/
hasShadow(): boolean;
/** Hides the window. */
hide(): void;
/**
* Hooks a windows message. The `callback` is called when the message is received in the WndProc (Windows only).
*
* @param message - The message identifier.
* @param callback - The callback invoked when the message is received.
*/
hookWindowMessage(message: number, callback: (wParam: unknown, lParam: unknown) => void): void;
/**
* Returns whether the window is always on top of other windows.
*
* @returns Whether the window is always on top.
*/
isAlwaysOnTop(): boolean;
/**
* Returns whether the window can be manually closed by user. On Linux always returns `true` (macOS and Windows).
*
* @returns Whether the window is closable.
*/
isClosable(): boolean;
/**
* Returns whether the window has been destroyed.
*
* @returns Whether the window is destroyed.
*/
isDestroyed(): boolean;
/**
* Returns whether the window's document has been edited (macOS only).
*
* @returns Whether the document has been edited.
*/
isDocumentEdited(): boolean;
/**
* Returns whether the window is enabled.
*
* @returns Whether the window is enabled.
*/
isEnabled(): boolean;
/** Returns whether the window can be focused (macOS and Windows). */
isFocusable(): void;
/**
* Returns whether the window is focused.
*
* @returns Whether the window is focused.
*/
isFocused(): boolean;
/**
* Returns whether the window is in fullscreen mode.
*
* @returns Whether the window is fullscreen.
*/
isFullScreen(): boolean;
/**
* Returns whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
*
* @returns Whether the window is fullscreenable.
*/
isFullScreenable(): boolean;
/**
* Returns whether the window is in kiosk mode.
*
* @returns Whether the window is in kiosk mode.
*/
isKiosk(): boolean;
/**
* Returns whether the window can be manually maximized by user. On Linux always returns `true` (macOS and Windows).
*
* @returns Whether the window is maximizable.
*/
isMaximizable(): boolean;
/**
* Returns whether the window is maximized.
*
* @returns Whether the window is maximized.
*/
isMaximized(): boolean;
/**
* Returns whether the menu bar automatically hides itself.
*
* @returns Whether the menu bar auto-hides.
*/
isMenuBarAutoHide(): boolean;
/**
* Returns whether the menu bar is visible.
*
* @returns Whether the menu bar is visible.
*/
isMenuBarVisible(): boolean;
/**
* Returns whether the window can be manually minimized by user. On Linux always returns `true` (macOS and Windows).
*
* @returns Whether the window is minimizable.
*/
isMinimizable(): boolean;
/**
* Returns whether the window is minimized.
*
* @returns Whether the window is minimized.
*/
isMinimized(): boolean;
/**
* Returns whether the current window is a modal window.
*
* @returns Whether the window is modal.
*/
isModal(): boolean;
/**
* Returns whether the window can be moved by user. On Linux always returns `true` (macOS and Windows).
*
* @returns Whether the window is movable.
*/
isMovable(): boolean;
/**
* Returns whether the window is in normal state (not maximized, not minimized, not in fullscreen mode).
*
* @returns Whether the window is in normal state.
*/
isNormal(): boolean;
/**
* Returns whether the window can be manually resized by user.
*
* @returns Whether the window is resizable.
*/
isResizable(): boolean;
/**
* Returns whether the window is in simple (pre-Lion) fullscreen mode (macOS only).
*
* @returns Whether the window is in simple fullscreen mode.
*/
isSimpleFullScreen(): boolean;
/**
* Returns whether the window is in Windows 10 tablet mode (Windows only).
*
* @returns Whether the window is in tablet mode.
*/
isTabletMode(): boolean;
/**
* Returns whether the window is visible to the user.
*
* @returns Whether the window is visible.
*/
isVisible(): boolean;
/**
* Returns whether the window is visible on all workspaces. Always returns `false` on Windows.
*
* @returns Whether the window is visible on all workspaces.
*/
isVisibleOnAllWorkspaces(): boolean;
/**
* Returns whether the message is hooked (Windows only).
*
* @param message - The message identifier.
* @returns Whether the message is hooked.
*/
isWindowMessageHooked(message: number): boolean;
/**
* Loads a file into the window. Same as `webContents.loadFile`.
*
* @param filePath - The path to an HTML file relative to the root of the application.
* @param options - Options for loading the file.
* @returns A promise that resolves when the page has finished loading.
*/
loadFile(filePath: string, options?: ElectronBrowserWindowLoadFileOptions): Promise;
/**
* Loads a URL into the window. Same as `webContents.loadURL`.
*
* @param url - A remote address or a path to a local HTML file using the `file://` protocol.
* @param options - Options for loading the URL.
* @returns A promise that resolves when the page has finished loading.
*/
loadURL(url: string, options?: ElectronBrowserWindowLoadURLOptions): Promise;
/** Maximizes the window. This will also show (but not focus) the window if it isn't being displayed already. */
maximize(): void;
/** Merges all windows into one window with multiple tabs when native tabs are enabled (macOS only). */
mergeAllWindows(): void;
/** Minimizes the window. On some platforms the minimized window will be shown in the Dock. */
minimize(): void;
/**
* Moves window above the source window in the sense of z-order.
*
* @param mediaSourceId - The media source id of the window to move above.
*/
moveAbove(mediaSourceId: string): void;
/** Moves the current tab into a new window if native tabs are enabled and there is more than one tab (macOS only). */
moveTabToNewWindow(): void;
/** Moves window to top (z-order) regardless of focus. */
moveTop(): void;
/**
* Registers a listener for the given window event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This BrowserWindow instance.
*/
on(event: "always-on-top-changed", listener: (event: ElectronEvent, isAlwaysOnTop: boolean) => void): this;
/** */
on(event: "app-command", listener: (event: ElectronEvent, command: string) => void): this;
/** */
on(event: "blur", listener: (...args: unknown[]) => void): this;
/** */
on(event: "close", listener: (event: ElectronEvent) => void): this;
/** */
on(event: "closed", listener: (...args: unknown[]) => void): this;
/** */
on(event: "enter-full-screen", listener: (...args: unknown[]) => void): this;
/** */
on(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this;
/** */
on(event: "focus", listener: (...args: unknown[]) => void): this;
/** */
on(event: "hide", listener: (...args: unknown[]) => void): this;
/** */
on(event: "leave-full-screen", listener: (...args: unknown[]) => void): this;
/** */
on(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this;
/** */
on(event: "maximize", listener: (...args: unknown[]) => void): this;
/** */
on(event: "minimize", listener: (...args: unknown[]) => void): this;
/** */
on(event: "move", listener: (...args: unknown[]) => void): this;
/** */
on(event: "moved", listener: (...args: unknown[]) => void): this;
/** */
on(event: "new-window-for-tab", listener: (...args: unknown[]) => void): this;
/** */
on(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this;
/** */
on(event: "ready-to-show", listener: (...args: unknown[]) => void): this;
/** */
on(event: "resize", listener: (...args: unknown[]) => void): this;
/** */
on(event: "resized", listener: (...args: unknown[]) => void): this;
/** */
on(event: "responsive", listener: (...args: unknown[]) => void): this;
/** */
on(event: "restore", listener: (...args: unknown[]) => void): this;
/** */
on(event: "rotate-gesture", listener: (event: ElectronEvent, rotation: number) => void): this;
/** */
on(event: "scroll-touch-begin", listener: (...args: unknown[]) => void): this;
/** */
on(event: "scroll-touch-edge", listener: (...args: unknown[]) => void): this;
/** */
on(event: "scroll-touch-end", listener: (...args: unknown[]) => void): this;
/** */
on(event: "session-end", listener: (...args: unknown[]) => void): this;
/** */
on(event: "sheet-begin", listener: (...args: unknown[]) => void): this;
/** */
on(event: "sheet-end", listener: (...args: unknown[]) => void): this;
/** */
on(event: "show", listener: (...args: unknown[]) => void): this;
/** */
on(event: "swipe", listener: (event: ElectronEvent, direction: string) => void): this;
/** */
on(event: "system-context-menu", listener: (event: ElectronEvent, point: ElectronPoint) => void): this;
/** */
on(event: "unmaximize", listener: (...args: unknown[]) => void): this;
/** */
on(event: "unresponsive", listener: (...args: unknown[]) => void): this;
/** */
on(event: "will-move", listener: (event: ElectronEvent, newBounds: ElectronRectangle) => void): this;
/** */
on(event: "will-resize", listener: (event: ElectronEvent, newBounds: ElectronRectangle, details: ElectronWillResizeDetails) => void): this;
/**
* Registers a one-time listener for the given window event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This BrowserWindow instance.
*/
once(event: "always-on-top-changed", listener: (event: ElectronEvent, isAlwaysOnTop: boolean) => void): this;
/** */
once(event: "app-command", listener: (event: ElectronEvent, command: string) => void): this;
/** */
once(event: "blur", listener: (...args: unknown[]) => void): this;
/** */
once(event: "close", listener: (event: ElectronEvent) => void): this;
/** */
once(event: "closed", listener: (...args: unknown[]) => void): this;
/** */
once(event: "enter-full-screen", listener: (...args: unknown[]) => void): this;
/** */
once(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this;
/** */
once(event: "focus", listener: (...args: unknown[]) => void): this;
/** */
once(event: "hide", listener: (...args: unknown[]) => void): this;
/** */
once(event: "leave-full-screen", listener: (...args: unknown[]) => void): this;
/** */
once(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this;
/** */
once(event: "maximize", listener: (...args: unknown[]) => void): this;
/** */
once(event: "minimize", listener: (...args: unknown[]) => void): this;
/** */
once(event: "move", listener: (...args: unknown[]) => void): this;
/** */
once(event: "moved", listener: (...args: unknown[]) => void): this;
/** */
once(event: "new-window-for-tab", listener: (...args: unknown[]) => void): this;
/** */
once(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this;
/** */
once(event: "ready-to-show", listener: (...args: unknown[]) => void): this;
/** */
once(event: "resize", listener: (...args: unknown[]) => void): this;
/** */
once(event: "resized", listener: (...args: unknown[]) => void): this;
/** */
once(event: "responsive", listener: (...args: unknown[]) => void): this;
/** */
once(event: "restore", listener: (...args: unknown[]) => void): this;
/** */
once(event: "rotate-gesture", listener: (event: ElectronEvent, rotation: number) => void): this;
/** */
once(event: "scroll-touch-begin", listener: (...args: unknown[]) => void): this;
/** */
once(event: "scroll-touch-edge", listener: (...args: unknown[]) => void): this;
/** */
once(event: "scroll-touch-end", listener: (...args: unknown[]) => void): this;
/** */
once(event: "session-end", listener: (...args: unknown[]) => void): this;
/** */
once(event: "sheet-begin", listener: (...args: unknown[]) => void): this;
/** */
once(event: "sheet-end", listener: (...args: unknown[]) => void): this;
/** */
once(event: "show", listener: (...args: unknown[]) => void): this;
/** */
once(event: "swipe", listener: (event: ElectronEvent, direction: string) => void): this;
/** */
once(event: "system-context-menu", listener: (event: ElectronEvent, point: ElectronPoint) => void): this;
/** */
once(event: "unmaximize", listener: (...args: unknown[]) => void): this;
/** */
once(event: "unresponsive", listener: (...args: unknown[]) => void): this;
/** */
once(event: "will-move", listener: (event: ElectronEvent, newBounds: ElectronRectangle) => void): this;
/** */
once(event: "will-resize", listener: (event: ElectronEvent, newBounds: ElectronRectangle, details: ElectronWillResizeDetails) => void): this;
/**
* Uses Quick Look to preview a file at a given path (macOS only).
*
* @param path - The path to the file to preview.
* @param displayName - The name of the file to display in the Quick Look modal view.
*/
previewFile(path: string, displayName?: string): void;
/** Reloads the current page. Same as `webContents.reload`. */
reload(): void;
/**
* Removes a view added with `addBrowserView` or `setBrowserView`.
*
* @param browserView - The view to remove.
*/
removeBrowserView(browserView: ElectronBrowserView): void;
/**
* Removes a listener for the given window event.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This BrowserWindow instance.
*/
removeListener(event: "always-on-top-changed", listener: (event: ElectronEvent, isAlwaysOnTop: boolean) => void): this;
/** */
removeListener(event: "app-command", listener: (event: ElectronEvent, command: string) => void): this;
/** */
removeListener(event: "blur", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "close", listener: (event: ElectronEvent) => void): this;
/** */
removeListener(event: "closed", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "enter-full-screen", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "enter-html-full-screen", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "focus", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "hide", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "leave-full-screen", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "leave-html-full-screen", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "maximize", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "minimize", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "move", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "moved", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "new-window-for-tab", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "page-title-updated", listener: (event: ElectronEvent, title: string, explicitSet: boolean) => void): this;
/** */
removeListener(event: "ready-to-show", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "resize", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "resized", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "responsive", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "restore", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "rotate-gesture", listener: (event: ElectronEvent, rotation: number) => void): this;
/** */
removeListener(event: "scroll-touch-begin", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "scroll-touch-edge", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "scroll-touch-end", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "session-end", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "sheet-begin", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "sheet-end", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "show", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "swipe", listener: (event: ElectronEvent, direction: string) => void): this;
/** */
removeListener(event: "system-context-menu", listener: (event: ElectronEvent, point: ElectronPoint) => void): this;
/** */
removeListener(event: "unmaximize", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "unresponsive", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "will-move", listener: (event: ElectronEvent, newBounds: ElectronRectangle) => void): this;
/** */
removeListener(event: "will-resize", listener: (event: ElectronEvent, newBounds: ElectronRectangle, details: ElectronWillResizeDetails) => void): this;
/** Removes the window's menu bar (Linux and Windows). */
removeMenu(): void;
/** Restores the window from minimized state to its previous state. */
restore(): void;
/** Selects the next tab when native tabs are enabled and there are other tabs in the window (macOS only). */
selectNextTab(): void;
/** Selects the previous tab when native tabs are enabled and there are other tabs in the window (macOS only). */
selectPreviousTab(): void;
/**
* Sets whether the window should show always on top of other windows.
*
* @param flag - Whether to set always on top.
* @param level - The always-on-top level (macOS only).
* @param relativeLevel - The number of layers higher to set this window relative to the given `level`.
*/
setAlwaysOnTop(flag: boolean, level?: "floating" | "main-menu" | "modal-panel" | "normal" | "pop-up-menu" | "screen-saver" | "status" | "torn-off-menu", relativeLevel?: number): void;
/**
* Sets the properties for the window's taskbar button (Windows only).
*
* @param options - The taskbar button properties.
*/
setAppDetails(options: ElectronAppDetailsOptions): void;
/**
* Makes the window maintain an aspect ratio.
*
* @param aspectRatio - The aspect ratio to maintain.
* @param extraSize - Extra size not included within the aspect ratio calculations.
*/
setAspectRatio(aspectRatio: number, extraSize?: ElectronSize): void;
/**
* Controls whether to hide the cursor when typing (macOS only).
*
* @param autoHide - Whether to auto-hide the cursor.
*/
setAutoHideCursor(autoHide: boolean): void;
/**
* Sets whether the window menu bar should hide itself automatically.
*
* @param hide - Whether to auto-hide the menu bar.
*/
setAutoHideMenuBar(hide: boolean): void;
/**
* Sets the background color of the window.
*
* @param backgroundColor - The CSS color value.
*/
setBackgroundColor(backgroundColor: string): void;
/**
* Resizes and moves the window to the supplied bounds. Any properties not supplied default to their current values.
*
* @param bounds - The new bounds.
* @param animate - Whether to animate the transition.
*/
setBounds(bounds: Partial, animate?: boolean): void;
/**
* Sets the view attached to the window.
*
* @param browserView - The view to attach, or `null` to detach.
*/
setBrowserView(browserView: ElectronBrowserView | null): void;
/**
* Sets whether the window can be manually closed by user. On Linux does nothing (macOS and Windows).
*
* @param closable - Whether the window is closable.
*/
setClosable(closable: boolean): void;
/**
* Resizes and moves the window's client area to the supplied bounds.
*
* @param bounds - The new content bounds.
* @param animate - Whether to animate the transition.
*/
setContentBounds(bounds: ElectronRectangle, animate?: boolean): void;
/**
* Prevents the window contents from being captured by other apps (macOS and Windows).
*
* @param enable - Whether to enable content protection.
*/
setContentProtection(enable: boolean): void;
/**
* Resizes the window's client area to `width` and `height`.
*
* @param width - The new width.
* @param height - The new height.
* @param animate - Whether to animate the transition.
*/
setContentSize(width: number, height: number, animate?: boolean): void;
/**
* Specifies whether the window's document has been edited (macOS only).
*
* @param edited - Whether the document has been edited.
*/
setDocumentEdited(edited: boolean): void;
/**
* Disables or enables the window.
*
* @param enable - Whether to enable the window.
*/
setEnabled(enable: boolean): void;
/**
* Changes whether the window can be focused (macOS and Windows).
*
* @param focusable - Whether the window is focusable.
*/
setFocusable(focusable: boolean): void;
/**
* Sets whether the window should be in fullscreen mode.
*
* @param flag - Whether to enable fullscreen.
*/
setFullScreen(flag: boolean): void;
/**
* Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
*
* @param fullscreenable - Whether the window is fullscreenable.
*/
setFullScreenable(fullscreenable: boolean): void;
/**
* Sets whether the window should have a shadow.
*
* @param hasShadow - Whether the window should have a shadow.
*/
setHasShadow(hasShadow: boolean): void;
/**
* Changes the window icon (Linux and Windows).
*
* @param icon - The icon image or path.
*/
setIcon(icon: ElectronNativeImage | string): void;
/**
* Makes the window ignore all mouse events.
*
* @param ignore - Whether to ignore mouse events.
* @param options - Additional options.
*/
setIgnoreMouseEvents(ignore: boolean, options?: ElectronIgnoreMouseEventsOptions): void;
/**
* Enters or leaves kiosk mode.
*
* @param flag - Whether to enable kiosk mode.
*/
setKiosk(flag: boolean): void;
/**
* Sets whether the window can be manually maximized by user. On Linux does nothing (macOS and Windows).
*
* @param maximizable - Whether the window is maximizable.
*/
setMaximizable(maximizable: boolean): void;
/**
* Sets the maximum size of the window.
*
* @param width - The maximum width.
* @param height - The maximum height.
*/
setMaximumSize(width: number, height: number): void;
/**
* Sets the menu as the window's menu bar (Linux and Windows).
*
* @param menu - The menu to set, or `null` to remove it.
*/
setMenu(menu: ElectronMenu | null): void;
/**
* Sets whether the menu bar should be visible (Linux and Windows).
*
* @param visible - Whether the menu bar is visible.
*/
setMenuBarVisibility(visible: boolean): void;
/**
* Sets whether the window can be manually minimized by user. On Linux does nothing (macOS and Windows).
*
* @param minimizable - Whether the window is minimizable.
*/
setMinimizable(minimizable: boolean): void;
/**
* Sets the minimum size of the window.
*
* @param width - The minimum width.
* @param height - The minimum height.
*/
setMinimumSize(width: number, height: number): void;
/**
* Sets whether the window can be moved by user. On Linux does nothing (macOS and Windows).
*
* @param movable - Whether the window is movable.
*/
setMovable(movable: boolean): void;
/**
* Sets the opacity of the window. On Linux, does nothing. Out of bound values are clamped to the `[0, 1]` range.
*
* @param opacity - The opacity value between `0.0` and `1.0`.
*/
setOpacity(opacity: number): void;
/**
* Sets a 16 x 16 pixel overlay onto the current taskbar icon (Windows only).
*
* @param overlay - The overlay image, or `null` to remove the overlay.
* @param description - A description of the overlay for accessibility tools.
*/
setOverlayIcon(overlay: ElectronNativeImage | null, description: string): void;
/**
* Sets the parent window. Passing `null` will turn the current window into a top-level window.
*
* @param parent - The new parent window, or `null`.
*/
setParentWindow(parent: ElectronBrowserWindow | null): void;
/**
* Moves the window to `x` and `y`.
*
* @param x - The x coordinate.
* @param y - The y coordinate.
* @param animate - Whether to animate the transition.
*/
setPosition(x: number, y: number, animate?: boolean): void;
/**
* Sets the progress value in the progress bar. Valid range is `[0, 1.0]`.
*
* @param progress - The progress value.
* @param options - Additional options.
*/
setProgressBar(progress: number, options?: ElectronProgressBarOptions): void;
/**
* Sets the pathname of the file the window represents (macOS only).
*
* @param filename - The represented filename.
*/
setRepresentedFilename(filename: string): void;
/**
* Sets whether the window can be manually resized by user.
*
* @param resizable - Whether the window is resizable.
*/
setResizable(resizable: boolean): void;
/**
* Sets a window shape determining the area within the window where drawing and user interaction are permitted
* (Linux and Windows).
*
* @param rects - The rectangles defining the window shape.
*/
setShape(rects: ElectronRectangle[]): void;
/**
* Changes the attachment point for sheets on macOS (macOS only).
*
* @param offsetY - The vertical offset.
* @param offsetX - The horizontal offset.
*/
setSheetOffset(offsetY: number, offsetX?: number): void;
/**
* Enters or leaves simple fullscreen mode (macOS only).
*
* @param flag - Whether to enable simple fullscreen mode.
*/
setSimpleFullScreen(flag: boolean): void;
/**
* Resizes the window to `width` and `height`.
*
* @param width - The new width.
* @param height - The new height.
* @param animate - Whether to animate the transition.
*/
setSize(width: number, height: number, animate?: boolean): void;
/**
* Makes the window not show in the taskbar.
*
* @param skip - Whether to skip the taskbar.
*/
setSkipTaskbar(skip: boolean): void;
/**
* Adds a thumbnail toolbar with a specified set of buttons to the thumbnail image of a window (Windows only).
*
* @param buttons - The buttons to add.
* @returns Whether the buttons were added successfully.
*/
setThumbarButtons(buttons: ElectronThumbarButton[]): boolean;
/**
* Sets the region of the window to show as the thumbnail image displayed when hovering over the window in the
* taskbar (Windows only).
*
* @param region - The region to show as the thumbnail.
*/
setThumbnailClip(region: ElectronRectangle): void;
/**
* Sets the tooltip displayed when hovering over the window thumbnail in the taskbar (Windows only).
*
* @param toolTip - The tooltip text.
*/
setThumbnailToolTip(toolTip: string): void;
/**
* Changes the title of the native window.
*
* @param title - The new title.
*/
setTitle(title: string): void;
/**
* On a window with Window Controls Overlay already enabled, updates the style of the title bar overlay
* (Windows only).
*
* @param options - The title bar overlay style.
*/
setTitleBarOverlay(options: ElectronTitleBarOverlayOptions): void;
/**
* Raises `browserView` above other views attached to the window.
*
* @param browserView - The view to raise.
*/
setTopBrowserView(browserView: ElectronBrowserView): void;
/**
* Sets the touch bar layout for the current window. Specifying `null` or `undefined` clears the touch bar
* (macOS only).
*
* @param touchBar - The touch bar, or `null` to clear it.
*/
setTouchBar(touchBar: ElectronTouchBar | null): void;
/**
* Sets a custom position for the traffic light buttons in a frameless window (macOS only).
*
* @param position - The traffic light position.
*/
setTrafficLightPosition(position: ElectronPoint): void;
/**
* Adds a vibrancy effect to the browser window. Passing `null` or an empty string removes the effect (macOS only).
*
* @param type - The vibrancy type, or `null` to remove the effect.
*/
setVibrancy(type: "appearance-based" | "content" | "dark" | "fullscreen-ui" | "header" | "hud" | "light" | "medium-light" | "menu" | "popover" | "selection" | "sheet" | "sidebar" | "titlebar" | "tooltip" | "ultra-dark" | "under-page" | "under-window" | "window" | null): void;
/**
* Sets whether the window should be visible on all workspaces. Does nothing on Windows.
*
* @param visible - Whether the window is visible on all workspaces.
* @param options - Additional options.
*/
setVisibleOnAllWorkspaces(visible: boolean, options?: ElectronVisibleOnAllWorkspacesOptions): void;
/**
* Sets whether the window traffic light buttons should be visible (macOS only).
*
* @param visible - Whether the traffic light buttons are visible.
*/
setWindowButtonVisibility(visible: boolean): void;
/** Shows and gives focus to the window. */
show(): void;
/** Shows the definition for the selected word (macOS only). Same as `webContents.showDefinitionForSelection()`. */
showDefinitionForSelection(): void;
/** Shows the window but doesn't focus on it. */
showInactive(): void;
/** Toggles the visibility of the tab bar if native tabs are enabled and there is only one tab (macOS only). */
toggleTabBar(): void;
/** Unhooks all of the window messages (Windows only). */
unhookAllWindowMessages(): void;
/**
* Unhooks the window message (Windows only).
*
* @param message - The message identifier.
*/
unhookWindowMessage(message: number): void;
/** Unmaximizes the window. */
unmaximize(): void;
}
/**
* An HTTP/HTTPS request issued through the `net` module.
*
* @public
* @unofficial
*/
export declare class ElectronClientRequest {
/**
* A `boolean` specifying whether the request will use HTTP chunked transfer encoding or not. The property is
* readable and writable, however it can be set only before the first write operation as the HTTP headers are not
* yet put on the wire. Trying to set the `chunkedEncoding` property after the first write will throw an error.
*
* Using chunked encoding is strongly recommended if you need to send a large request body as data will be streamed
* in small chunks instead of being internally buffered inside Electron process memory.
*
* @default `false`
*/
chunkedEncoding: boolean;
/**
* Create new instance of {@link ElectronClientRequest}.
*
* @param options - The request options, or the request URL as a string.
*/
constructor(options: ElectronClientRequestConstructorOptions | string);
/**
* Cancels an ongoing HTTP transaction. If the request has already emitted the `close` event, the abort operation
* will have no effect. Otherwise an ongoing event will emit `abort` and `close` events. Additionally, if there is
* an ongoing response object, it will emit the `aborted` event.
*/
abort(): void;
/**
* Registers a listener for the given request event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This `ClientRequest` instance.
*/
addListener(event: "abort", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "close", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "error", listener: (error: Error) => void): this;
/** */
addListener(event: "finish", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this;
/** */
addListener(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record) => void): this;
/** */
addListener(event: "response", listener: (response: ElectronIncomingMessage) => void): this;
/**
* Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. The `finish`
* event is emitted just after the end operation.
*
* @param chunk - The final chunk of request body data.
* @param encoding - The encoding of `chunk`.
* @param callback - Invoked after the chunk content has been delivered to the Chromium networking layer.
*/
end(chunk?: Buffer | string, encoding?: string, callback?: () => void): void;
/**
* Continues any pending redirection. Can only be called during a `'redirect'` event.
*/
followRedirect(): void;
/**
* The value of a previously set extra header name.
*
* @param name - The header name.
* @returns The header value.
*/
getHeader(name: string): string;
/**
* You can use this method in conjunction with `POST` requests to get the progress of a file upload or other data
* transfer.
*
* @returns The current upload progress.
*/
getUploadProgress(): ElectronUploadProgress;
/**
* Registers a listener for the given request event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This `ClientRequest` instance.
*/
on(event: "abort", listener: (...args: unknown[]) => void): this;
/** */
on(event: "close", listener: (...args: unknown[]) => void): this;
/** */
on(event: "error", listener: (error: Error) => void): this;
/** */
on(event: "finish", listener: (...args: unknown[]) => void): this;
/** */
on(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this;
/** */
on(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record) => void): this;
/** */
on(event: "response", listener: (response: ElectronIncomingMessage) => void): this;
/**
* Registers a one-time listener for the given request event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This `ClientRequest` instance.
*/
once(event: "abort", listener: (...args: unknown[]) => void): this;
/** */
once(event: "close", listener: (...args: unknown[]) => void): this;
/** */
once(event: "error", listener: (error: Error) => void): this;
/** */
once(event: "finish", listener: (...args: unknown[]) => void): this;
/** */
once(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this;
/** */
once(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record) => void): this;
/** */
once(event: "response", listener: (response: ElectronIncomingMessage) => void): this;
/**
* Removes a previously set extra header name. This method can be called only before first write. Trying to call it
* after the first write will throw an error.
*
* @param name - The header name to remove.
*/
removeHeader(name: string): void;
/**
* Removes the given listener for the given request event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This `ClientRequest` instance.
*/
removeListener(event: "abort", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "close", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "error", listener: (error: Error) => void): this;
/** */
removeListener(event: "finish", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "login", listener: (authInfo: ElectronAuthInfo, callback: (username?: string, password?: string) => void) => void): this;
/** */
removeListener(event: "redirect", listener: (statusCode: number, method: string, redirectUrl: string, responseHeaders: Record) => void): this;
/** */
removeListener(event: "response", listener: (response: ElectronIncomingMessage) => void): this;
/**
* Adds an extra HTTP header. The header name will be issued as-is without lowercasing. It can be called only before
* first write. Calling this method after the first write will throw an error. If the passed value is not a
* `string`, its `toString()` method will be called to obtain the final value.
*
* @param name - The header name.
* @param value - The header value.
*/
setHeader(name: string, value: string): void;
/**
* Adds a chunk of data to the request body. The first write operation may cause the request headers to be issued on
* the wire. After the first write operation, it is not allowed to add or remove a custom header.
*
* @param chunk - A chunk of request body data.
* @param encoding - The encoding of `chunk`.
* @param callback - Invoked after the chunk content has been delivered to the Chromium networking layer.
*/
write(chunk: Buffer | string, encoding?: string, callback?: () => void): void;
}
/**
* An HTTP response message returned by a `ClientRequest`.
*
* @public
* @unofficial
*/
export declare class ElectronIncomingMessage {
/**
* A `Record` representing the HTTP response headers. The `headers` object is formatted
* as follows:
*
* - All header names are lowercased.
* - Duplicates of `age`, `authorization`, `content-length`, `content-type`, `etag`, `expires`, `from`, `host`,
* `if-modified-since`, `if-unmodified-since`, `last-modified`, `location`, `max-forwards`, `proxy-authorization`,
* `referer`, `retry-after`, `server`, or `user-agent` are discarded.
* - `set-cookie` is always an array. Duplicates are added to the array.
* - For duplicate `cookie` headers, the values are joined together with `'; '`.
* - For all other headers, the values are joined together with `', '`.
*/
headers: Record;
/**
* A `string` indicating the HTTP protocol version number. Typical values are `'1.0'` or `'1.1'`. Additionally
* `httpVersionMajor` and `httpVersionMinor` are two Integer-valued readable properties that return respectively the
* HTTP major and minor version numbers.
*/
httpVersion: string;
/** An `Integer` indicating the HTTP protocol major version number. */
httpVersionMajor: number;
/** An `Integer` indicating the HTTP protocol minor version number. */
httpVersionMinor: number;
/**
* A `string[]` containing the raw HTTP response headers exactly as they were received. The keys and values are in
* the same list. It is not a list of tuples. So, the even-numbered offsets are key values, and the odd-numbered
* offsets are the associated values. Header names are not lowercased, and duplicates are not merged.
*/
rawHeaders: string[];
/** An `Integer` indicating the HTTP response status code. */
statusCode: number;
/** A `string` representing the HTTP status message. */
statusMessage: string;
/**
* Registers a listener for the given response event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This `IncomingMessage` instance.
*/
addListener(event: "aborted", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "data", listener: (chunk: Buffer) => void): this;
/** */
addListener(event: "end", listener: (...args: unknown[]) => void): this;
/** */
addListener(event: "error", listener: (...args: unknown[]) => void): this;
/**
* Registers a listener for the given response event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This `IncomingMessage` instance.
*/
on(event: "aborted", listener: (...args: unknown[]) => void): this;
/** */
on(event: "data", listener: (chunk: Buffer) => void): this;
/** */
on(event: "end", listener: (...args: unknown[]) => void): this;
/** */
on(event: "error", listener: (...args: unknown[]) => void): this;
/**
* Registers a one-time listener for the given response event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This `IncomingMessage` instance.
*/
once(event: "aborted", listener: (...args: unknown[]) => void): this;
/** */
once(event: "data", listener: (chunk: Buffer) => void): this;
/** */
once(event: "end", listener: (...args: unknown[]) => void): this;
/** */
once(event: "error", listener: (...args: unknown[]) => void): this;
/**
* Removes the given listener for the given response event.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This `IncomingMessage` instance.
*/
removeListener(event: "aborted", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "data", listener: (chunk: Buffer) => void): this;
/** */
removeListener(event: "end", listener: (...args: unknown[]) => void): this;
/** */
removeListener(event: "error", listener: (...args: unknown[]) => void): this;
}
/**
* Electron Menu for creating native application menus and context menus.
*
* @public
* @unofficial
*/
export declare class ElectronMenu {
/**
* A `MenuItem[]` array containing the menu's items.
*
* Each menu consists of multiple menu items and each menu item can have a submenu.
*/
items: ElectronMenuItem[];
/** Create a new instance of {@link ElectronMenu}. */
constructor();
/**
* Registers an event listener that is invoked when a popup is closed either manually or with {@link ElectronMenu.closePopup}.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This menu instance.
*/
addListener(event: "menu-will-close", listener: (event: ElectronEvent) => void): this;
/**
* Registers an event listener that is invoked when {@link ElectronMenu.popup} is called.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This menu instance.
*/
addListener(event: "menu-will-show", listener: (event: ElectronEvent) => void): this;
/**
* Appends the `menuItem` to the menu.
*
* @param menuItem - The menu item to append.
*/
append(menuItem: ElectronMenuItem): void;
/**
* Generally, the `template` is an array of options for constructing a menu item.
*
* You can also attach other fields to the elements of the `template` and they will become properties of the constructed menu items.
*
* @param template - The template describing the menu items.
* @returns The constructed menu.
*/
static buildFromTemplate(template: Array): ElectronMenu;
/**
* Closes the context menu in the `browserWindow`.
*
* @param browserWindow - The window to close the popup in.
*/
closePopup(browserWindow?: ElectronBrowserWindow): void;
/**
* Returns the application menu, if set, or `null`, if not set.
*
* The returned menu instance doesn't support dynamic addition or removal of menu items. Instance properties can still be dynamically modified.
*
* @returns The application menu, or `null` if not set.
*/
static getApplicationMenu(): ElectronMenu | null;
/**
* Returns the item with the specified `id`.
*
* @param id - The id of the menu item.
* @returns The matching menu item, or `null` if not found.
*/
getMenuItemById(id: string): ElectronMenuItem | null;
/**
* Inserts the `menuItem` to the `pos` position of the menu.
*
* @param pos - The position to insert at.
* @param menuItem - The menu item to insert.
*/
insert(pos: number, menuItem: ElectronMenuItem): void;
/**
* Registers an event listener that is invoked when a popup is closed either manually or with {@link ElectronMenu.closePopup}.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This menu instance.
*/
on(event: "menu-will-close", listener: (event: ElectronEvent) => void): this;
/**
* Registers an event listener that is invoked when {@link ElectronMenu.popup} is called.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This menu instance.
*/
on(event: "menu-will-show", listener: (event: ElectronEvent) => void): this;
/**
* Registers a one-time event listener that is invoked when a popup is closed either manually or with {@link ElectronMenu.closePopup}.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This menu instance.
*/
once(event: "menu-will-close", listener: (event: ElectronEvent) => void): this;
/**
* Registers a one-time event listener that is invoked when {@link ElectronMenu.popup} is called.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This menu instance.
*/
once(event: "menu-will-show", listener: (event: ElectronEvent) => void): this;
/**
* Pops up this menu as a context menu in the `BrowserWindow`.
*
* @param options - Options for the popup including `window`, `x`, and `y`.
*/
popup(options?: ElectronMenuPopupOptions): void;
/**
* Removes the event listener for a menu popup being closed.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This menu instance.
*/
removeListener(event: "menu-will-close", listener: (event: ElectronEvent) => void): this;
/**
* Removes the event listener for a menu popup being shown.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This menu instance.
*/
removeListener(event: "menu-will-show", listener: (event: ElectronEvent) => void): this;
/**
* Sends the `action` to the first responder of application. This is used for emulating default macOS menu behaviors. Usually you would use the `role` property of a menu item. `darwin` only.
*
* @param action - The action to send to the first responder.
*/
static sendActionToFirstResponder(action: string): void;
/**
* Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu` will be set as each window's top menu.
*
* Passing `null` will suppress the default menu. On Windows and Linux, this has the additional effect of removing the menu bar from the window.
*
* @param menu - The menu to set, or `null` to suppress the default menu.
*/
static setApplicationMenu(menu: ElectronMenu | null): void;
}
/**
* Electron MenuItem for adding items to native application menus.
*
* @public
* @unofficial
*/
export declare class ElectronMenuItem {
/** The item's accelerator, if set. */
accelerator?: ElectronAccelerator;
/** Whether the item is checked. This property can be dynamically changed. */
checked: boolean;
/** An item's sequential unique id. */
commandId: number;
/** Whether the item is enabled. This property can be dynamically changed. */
enabled: boolean;
/** The item's icon, if set. */
icon?: ElectronNativeImage | string;
/** The item's unique id. This property can be dynamically changed. */
id: string;
/** The item's visible label. */
label: string;
/** The menu that the item is a part of. */
menu: ElectronMenu;
/** Whether the accelerator should be registered with the system or just displayed. This property can be dynamically changed. */
registerAccelerator: boolean;
/** The item's role, if set. */
role?: "about" | "appMenu" | "clearRecentDocuments" | "close" | "copy" | "cut" | "delete" | "editMenu" | "fileMenu" | "forceReload" | "front" | "help" | "hide" | "hideOthers" | "mergeAllWindows" | "minimize" | "moveTabToNewWindow" | "paste" | "pasteAndMatchStyle" | "quit" | "recentDocuments" | "redo" | "reload" | "resetZoom" | "selectAll" | "selectNextTab" | "selectPreviousTab" | "services" | "shareMenu" | "startSpeaking" | "stopSpeaking" | "toggleDevTools" | "togglefullscreen" | "toggleSpellChecker" | "toggleTabBar" | "undo" | "unhide" | "viewMenu" | "window" | "windowMenu" | "zoom" | "zoomIn" | "zoomOut";
/** The item to share when the `role` is `shareMenu`. This property can be dynamically changed. `darwin` only. */
sharingItem: ElectronSharingItem;
/** The item's sublabel. */
sublabel: string;
/** The menu item's submenu, if present. */
submenu?: ElectronMenu;
/** The item's hover text. `darwin` only. */
toolTip: string;
/** The type of the item. */
type: "checkbox" | "normal" | "radio" | "separator" | "submenu";
/** The item's user-assigned accelerator for the menu item. Only initialized after the item has been added to a menu; accessing before initialization returns `null`. `darwin` only. */
readonly userAccelerator: ElectronAccelerator | null;
/** Whether the item is visible. This property can be dynamically changed. */
visible: boolean;
/**
* Creates a new menu item.
*
* @param options - The menu item options.
*/
constructor(options: ElectronMenuItemConstructorOptions);
/**
* The click handler that is fired when the menu item receives a click event.
*
* @param menuItem - The menu item that was clicked.
* @param browserWindow - The focused window, or `undefined` if none.
* @param event - The keyboard event associated with the click.
* @returns Nothing.
*/
click(menuItem: ElectronMenuItem, browserWindow: ElectronBrowserWindow | undefined, event: KeyboardEvent): void;
}
/**
* A main-process channel that owns a pair of connected {@link ElectronMessagePortMain} ports.
*
* @public
* @unofficial
*/
export declare class ElectronMessageChannelMain {
/** One of the two connected `MessagePortMain` ports of this channel. */
port1: ElectronMessagePortMain;
/** The other of the two connected `MessagePortMain` ports of this channel. */
port2: ElectronMessagePortMain;
/** Create a new instance of {@link ElectronMessageChannelMain}. */
constructor();
}
/**
* Electron Notification for creating and showing native OS notifications.
*
* @public
* @unofficial
*/
export declare class ElectronNotification {
/** A `NotificationAction[]` property representing the actions of the notification. */
actions: ElectronNotificationAction[];
/** A `string` property representing the body of the notification. */
body: string;
/** A `string` property representing the close button text of the notification. */
closeButtonText: string;
/** A `boolean` property representing whether the notification has a reply action. */
hasReply: boolean;
/** A `string` property representing the reply placeholder of the notification. */
replyPlaceholder: string;
/** A `boolean` property representing whether the notification is silent. */
silent: boolean;
/** A `string` property representing the sound of the notification. */
sound: string;
/** A `string` property representing the subtitle of the notification. */
subtitle: string;
/**
* A `string` property representing the type of timeout duration for the notification. Can be `default` or `never`.
*
* If `timeoutType` is set to `never`, the notification never expires. It stays open until closed by the calling API or the user. `linux` and `win32` only.
*/
timeoutType: "default" | "never";
/** A `string` property representing the title of the notification. */
title: string;
/** A `string` property representing the custom Toast XML of the notification. `win32` only. */
toastXml: string;
/**
* A `string` property representing the urgency level of the notification. Can be `normal`, `critical`, or `low`.
*
* Default is `low`. `linux` only.
*/
urgency: "critical" | "low" | "normal";
/**
* Create a new instance of {@link ElectronNotification}.
*
* @param options - Options for constructing the notification.
*/
constructor(options?: ElectronNotificationConstructorOptions);
/**
* Registers an event listener that is invoked when one of the notification's actions is activated.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the index of the activated action.
* @returns This notification instance.
*/
addListener(event: "action", listener: (event: ElectronEvent, index: number) => void): this;
/**
* Registers an event listener that is invoked when the notification is clicked by the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
addListener(event: "click", listener: (event: ElectronEvent) => void): this;
/**
* Registers an event listener that is invoked when the notification is closed by manual intervention from the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
addListener(event: "close", listener: (event: ElectronEvent) => void): this;
/**
* Registers an event listener that is invoked when an error is encountered while creating and showing the native notification. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the error encountered during execution of the `show()` method.
* @returns This notification instance.
*/
addListener(event: "failed", listener: (event: ElectronEvent, error: string) => void): this;
/**
* Registers an event listener that is invoked when the user clicks the "Reply" button on a notification with `hasReply: true`. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the string the user entered into the inline reply field.
* @returns This notification instance.
*/
addListener(event: "reply", listener: (event: ElectronEvent, reply: string) => void): this;
/**
* Registers an event listener that is invoked when the notification is shown to the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
addListener(event: "show", listener: (event: ElectronEvent) => void): this;
/** Dismisses the notification. */
close(): void;
/**
* Whether or not desktop notifications are supported on the current system.
*
* @returns `true` if desktop notifications are supported.
*/
static isSupported(): boolean;
/**
* Registers an event listener that is invoked when one of the notification's actions is activated.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the index of the activated action.
* @returns This notification instance.
*/
on(event: "action", listener: (event: ElectronEvent, index: number) => void): this;
/**
* Registers an event listener that is invoked when the notification is clicked by the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
on(event: "click", listener: (event: ElectronEvent) => void): this;
/**
* Registers an event listener that is invoked when the notification is closed by manual intervention from the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
on(event: "close", listener: (event: ElectronEvent) => void): this;
/**
* Registers an event listener that is invoked when an error is encountered while creating and showing the native notification. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the error encountered during execution of the `show()` method.
* @returns This notification instance.
*/
on(event: "failed", listener: (event: ElectronEvent, error: string) => void): this;
/**
* Registers an event listener that is invoked when the user clicks the "Reply" button on a notification with `hasReply: true`. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the string the user entered into the inline reply field.
* @returns This notification instance.
*/
on(event: "reply", listener: (event: ElectronEvent, reply: string) => void): this;
/**
* Registers an event listener that is invoked when the notification is shown to the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
on(event: "show", listener: (event: ElectronEvent) => void): this;
/**
* Registers a one-time event listener that is invoked when one of the notification's actions is activated.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the index of the activated action.
* @returns This notification instance.
*/
once(event: "action", listener: (event: ElectronEvent, index: number) => void): this;
/**
* Registers a one-time event listener that is invoked when the notification is clicked by the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
once(event: "click", listener: (event: ElectronEvent) => void): this;
/**
* Registers a one-time event listener that is invoked when the notification is closed by manual intervention from the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
once(event: "close", listener: (event: ElectronEvent) => void): this;
/**
* Registers a one-time event listener that is invoked when an error is encountered while creating and showing the native notification. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the error encountered during execution of the `show()` method.
* @returns This notification instance.
*/
once(event: "failed", listener: (event: ElectronEvent, error: string) => void): this;
/**
* Registers a one-time event listener that is invoked when the user clicks the "Reply" button on a notification with `hasReply: true`. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the string the user entered into the inline reply field.
* @returns This notification instance.
*/
once(event: "reply", listener: (event: ElectronEvent, reply: string) => void): this;
/**
* Registers a one-time event listener that is invoked when the notification is shown to the user.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This notification instance.
*/
once(event: "show", listener: (event: ElectronEvent) => void): this;
/**
* Removes the event listener for one of the notification's actions being activated.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This notification instance.
*/
removeListener(event: "action", listener: (event: ElectronEvent, index: number) => void): this;
/**
* Removes the event listener for the notification being clicked.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This notification instance.
*/
removeListener(event: "click", listener: (event: ElectronEvent) => void): this;
/**
* Removes the event listener for the notification being closed.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This notification instance.
*/
removeListener(event: "close", listener: (event: ElectronEvent) => void): this;
/**
* Removes the event listener for the notification failing to show.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This notification instance.
*/
removeListener(event: "failed", listener: (event: ElectronEvent, error: string) => void): this;
/**
* Removes the event listener for the notification's inline reply.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This notification instance.
*/
removeListener(event: "reply", listener: (event: ElectronEvent, reply: string) => void): this;
/**
* Removes the event listener for the notification being shown.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This notification instance.
*/
removeListener(event: "show", listener: (event: ElectronEvent) => void): this;
/**
* Immediately shows the notification to the user, please note this means unlike the HTML5 Notification implementation, instantiating a `new Notification` does not immediately show it to the user, you need to call this method before the OS will display it.
*
* If the notification has been shown before, this method will dismiss the previously shown notification and create a new one with identical properties.
*/
show(): void;
}
/**
* Electron ShareMenu for presenting the native share sheet for a {@link ElectronSharingItem}.
*
* @public
* @unofficial
*/
export declare class ElectronShareMenu {
/**
* Create a new instance of {@link ElectronShareMenu}.
*
* @param sharingItem - The item to share.
*/
constructor(sharingItem: ElectronSharingItem);
/**
* Closes the context menu in the `browserWindow`.
*
* @param browserWindow - The window to close the popup in.
*/
closePopup(browserWindow?: ElectronBrowserWindow): void;
/**
* Pops up this menu as a context menu in the `BrowserWindow`.
*
* @param options - Options for the popup including `window`, `x`, and `y`.
*/
popup(options?: ElectronMenuPopupOptions): void;
}
/**
* Electron TouchBar for building a macOS Touch Bar layout.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBar {
/** The item that replaces the "esc" button on the touch bar. Setting to `null` restores the default. */
escapeItem: ElectronTouchBarButton | ElectronTouchBarColorPicker | ElectronTouchBarGroup | ElectronTouchBarLabel | ElectronTouchBarPopover | ElectronTouchBarScrubber | ElectronTouchBarSegmentedControl | ElectronTouchBarSlider | ElectronTouchBarSpacer | null;
/** Reference to the {@link ElectronTouchBarButton} class. */
static TouchBarButton: typeof ElectronTouchBarButton;
/** Reference to the {@link ElectronTouchBarColorPicker} class. */
static TouchBarColorPicker: typeof ElectronTouchBarColorPicker;
/** Reference to the {@link ElectronTouchBarGroup} class. */
static TouchBarGroup: typeof ElectronTouchBarGroup;
/** Reference to the {@link ElectronTouchBarLabel} class. */
static TouchBarLabel: typeof ElectronTouchBarLabel;
/** Reference to the {@link ElectronTouchBarOtherItemsProxy} class. */
static TouchBarOtherItemsProxy: typeof ElectronTouchBarOtherItemsProxy;
/** Reference to the {@link ElectronTouchBarPopover} class. */
static TouchBarPopover: typeof ElectronTouchBarPopover;
/** Reference to the {@link ElectronTouchBarScrubber} class. */
static TouchBarScrubber: typeof ElectronTouchBarScrubber;
/** Reference to the {@link ElectronTouchBarSegmentedControl} class. */
static TouchBarSegmentedControl: typeof ElectronTouchBarSegmentedControl;
/** Reference to the {@link ElectronTouchBarSlider} class. */
static TouchBarSlider: typeof ElectronTouchBarSlider;
/** Reference to the {@link ElectronTouchBarSpacer} class. */
static TouchBarSpacer: typeof ElectronTouchBarSpacer;
/**
* Create new instance of {@link ElectronTouchBar}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarConstructorOptions);
}
/**
* A button item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarButton {
/** Description of the button to be read by a screen reader. Read only if no label is set. */
accessibilityLabel: string;
/** Hex code representing the button's current background color. */
backgroundColor: string;
/** Whether the button is in an enabled state. */
enabled: boolean;
/** The button's current icon. */
icon: ElectronNativeImage;
/** The position of the icon. */
iconPosition: "left" | "overlay" | "right";
/** The button's current text. */
label: string;
/**
* Create new instance of {@link ElectronTouchBarButton}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarButtonConstructorOptions);
}
/**
* A color picker item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarColorPicker {
/** The color picker's available colors to select. */
availableColors: string[];
/** Hex code representing the color picker's currently selected color. */
selectedColor: string;
/**
* Create new instance of {@link ElectronTouchBarColorPicker}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarColorPickerConstructorOptions);
}
/**
* A group item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarGroup {
/**
* Create new instance of {@link ElectronTouchBarGroup}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarGroupConstructorOptions);
}
/**
* A label item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarLabel {
/** Description of the label to be read by a screen reader. */
accessibilityLabel: string;
/** The label's current text. */
label: string;
/** Hex code representing the label's current text color. */
textColor: string;
/**
* Create new instance of {@link ElectronTouchBarLabel}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarLabelConstructorOptions);
}
/**
* A proxy item that reserves space for system-provided items in a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarOtherItemsProxy {
/**
* Create new instance of {@link ElectronTouchBarOtherItemsProxy}.
*/
constructor();
}
/**
* A popover item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarPopover {
/** The popover's current button icon. */
icon: ElectronNativeImage;
/** The popover's current button text. */
label: string;
/**
* Create new instance of {@link ElectronTouchBarPopover}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarPopoverConstructorOptions);
}
/**
* A scrubber item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarScrubber {
/** Whether this scrubber is continuous. */
continuous: boolean;
/** The items in this scrubber. */
items: ElectronScrubberItem[];
/** The mode of this scrubber. */
mode: "fixed" | "free";
/** The style that selected items in the scrubber should have, overlaid on top of the item. */
overlayStyle: "background" | "none" | "outline";
/** The style that selected items in the scrubber should have. */
selectedStyle: "background" | "none" | "outline";
/** Whether to show the left / right selection arrows in this scrubber. */
showArrowButtons: boolean;
/**
* Create new instance of {@link ElectronTouchBarScrubber}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarScrubberConstructorOptions);
}
/**
* A segmented control item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarSegmentedControl {
/** The current selection mode of the control. */
mode: "buttons" | "multiple" | "single";
/** The segments in this control. */
segments: ElectronSegmentedControlSegment[];
/** The control's current segment style. */
segmentStyle: string;
/** The currently selected segment. */
selectedIndex: number;
/**
* Create new instance of {@link ElectronTouchBarSegmentedControl}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarSegmentedControlConstructorOptions);
}
/**
* A slider item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarSlider {
/** The slider's current text. */
label: string;
/** The slider's current maximum value. */
maxValue: number;
/** The slider's current minimum value. */
minValue: number;
/** The slider's current value. */
value: number;
/**
* Create new instance of {@link ElectronTouchBarSlider}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarSliderConstructorOptions);
}
/**
* A spacer item for a {@link ElectronTouchBar}.
*
* @public
* @unofficial
*/
export declare class ElectronTouchBarSpacer {
/** The size of the spacer. */
size: "flexible" | "large" | "small";
/**
* Create new instance of {@link ElectronTouchBarSpacer}.
*
* @param options - Options.
*/
constructor(options: ElectronTouchBarSpacerConstructorOptions);
}
/**
* Electron Tray for adding icons and context menus to the system's notification area.
*
* @public
* @unofficial
*/
export declare class ElectronTray {
/**
* Create a new instance of {@link ElectronTray}.
*
* @param image - The image to use as the tray icon.
* @param guid - Assigns a GUID to the tray icon. `win32` only.
*/
constructor(image: ElectronNativeImage | string, guid?: string);
/**
* Registers an event listener that is invoked when the tray balloon is clicked. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
addListener(event: "balloon-click", listener: () => void): this;
/**
* Registers an event listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
addListener(event: "balloon-closed", listener: () => void): this;
/**
* Registers an event listener that is invoked when the tray balloon shows. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
addListener(event: "balloon-show", listener: () => void): this;
/**
* Registers an event listener that is invoked when the tray icon is clicked.
*
* @param event - The event name.
* @param listener - The event handler receiving the event, the bounds of the tray icon, and the position of the event.
* @returns This tray instance.
*/
addListener(event: "click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): this;
/**
* Registers an event listener that is invoked when the tray icon is double clicked. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the bounds of the tray icon.
* @returns This tray instance.
*/
addListener(event: "double-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this;
/**
* Registers an event listener that is invoked when a drag operation ends on the tray or ends at another location. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
addListener(event: "drag-end", listener: () => void): this;
/**
* Registers an event listener that is invoked when a drag operation enters the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
addListener(event: "drag-enter", listener: () => void): this;
/**
* Registers an event listener that is invoked when a drag operation exits the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
addListener(event: "drag-leave", listener: () => void): this;
/**
* Registers an event listener that is invoked when any dragged items are dropped on the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
addListener(event: "drop", listener: () => void): this;
/**
* Registers an event listener that is invoked when dragged files are dropped in the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the paths of the dropped files.
* @returns This tray instance.
*/
addListener(event: "drop-files", listener: (event: ElectronEvent, files: string[]) => void): this;
/**
* Registers an event listener that is invoked when dragged text is dropped in the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the dropped text string.
* @returns This tray instance.
*/
addListener(event: "drop-text", listener: (event: ElectronEvent, text: string) => void): this;
/**
* Registers an event listener that is invoked when the mouse clicks the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
addListener(event: "mouse-down", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers an event listener that is invoked when the mouse enters the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
addListener(event: "mouse-enter", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers an event listener that is invoked when the mouse exits the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
addListener(event: "mouse-leave", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers an event listener that is invoked when the mouse moves in the tray icon. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
addListener(event: "mouse-move", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers an event listener that is invoked when the mouse is released from clicking the tray icon.
*
* Note: This will not be emitted if you have set a context menu for your tray using {@link ElectronTray.setContextMenu}, as a result of macOS-level constraints. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
addListener(event: "mouse-up", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers an event listener that is invoked when the tray icon is right clicked. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the bounds of the tray icon.
* @returns This tray instance.
*/
addListener(event: "right-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this;
/**
* Closes an open context menu, as set by {@link ElectronTray.setContextMenu}. `darwin` and `win32` only.
*/
closeContextMenu(): void;
/** Destroys the tray icon immediately. */
destroy(): void;
/**
* Displays a tray balloon. `win32` only.
*
* @param options - Options describing the balloon to display.
*/
displayBalloon(options: ElectronDisplayBalloonOptions): void;
/**
* Returns focus to the taskbar notification area. Notification area icons should use this message when they have completed their UI operation. For example, if the icon displays a shortcut menu, but the user presses ESC to cancel it, use `tray.focus()` to return focus to the notification area. `win32` only.
*/
focus(): void;
/**
* The `bounds` of this tray icon. `darwin` and `win32` only.
*
* @returns The bounds of this tray icon.
*/
getBounds(): ElectronRectangle;
/**
* Whether double click events will be ignored. `darwin` only.
*
* @returns `true` if double click events are ignored.
*/
getIgnoreDoubleClickEvents(): boolean;
/**
* The title displayed next to the tray icon in the status bar. `darwin` only.
*
* @returns The title displayed next to the tray icon.
*/
getTitle(): string;
/**
* Whether the tray icon is destroyed.
*
* @returns `true` if the tray icon is destroyed.
*/
isDestroyed(): boolean;
/**
* Registers a listener that is invoked when the tray balloon is clicked. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
on(event: "balloon-click", listener: () => void): this;
/**
* Registers a listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
on(event: "balloon-closed", listener: () => void): this;
/**
* Registers a listener that is invoked when the tray balloon shows. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
on(event: "balloon-show", listener: () => void): this;
/**
* Registers a listener that is invoked when the tray icon is clicked.
*
* @param event - The event name.
* @param listener - The event handler receiving the event, the bounds of the tray icon, and the position of the event.
* @returns This tray instance.
*/
on(event: "click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): this;
/**
* Registers a listener that is invoked when the tray icon is double clicked. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the bounds of the tray icon.
* @returns This tray instance.
*/
on(event: "double-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this;
/**
* Registers a listener that is invoked when a drag operation ends on the tray or ends at another location. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
on(event: "drag-end", listener: () => void): this;
/**
* Registers a listener that is invoked when a drag operation enters the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
on(event: "drag-enter", listener: () => void): this;
/**
* Registers a listener that is invoked when a drag operation exits the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
on(event: "drag-leave", listener: () => void): this;
/**
* Registers a listener that is invoked when any dragged items are dropped on the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
on(event: "drop", listener: () => void): this;
/**
* Registers a listener that is invoked when dragged files are dropped in the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the paths of the dropped files.
* @returns This tray instance.
*/
on(event: "drop-files", listener: (event: ElectronEvent, files: string[]) => void): this;
/**
* Registers a listener that is invoked when dragged text is dropped in the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the dropped text string.
* @returns This tray instance.
*/
on(event: "drop-text", listener: (event: ElectronEvent, text: string) => void): this;
/**
* Registers a listener that is invoked when the mouse clicks the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
on(event: "mouse-down", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a listener that is invoked when the mouse enters the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
on(event: "mouse-enter", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a listener that is invoked when the mouse exits the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
on(event: "mouse-leave", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a listener that is invoked when the mouse moves in the tray icon. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
on(event: "mouse-move", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a listener that is invoked when the mouse is released from clicking the tray icon.
*
* Note: This will not be emitted if you have set a context menu for your tray using {@link ElectronTray.setContextMenu}, as a result of macOS-level constraints. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
on(event: "mouse-up", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a listener that is invoked when the tray icon is right clicked. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the bounds of the tray icon.
* @returns This tray instance.
*/
on(event: "right-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this;
/**
* Registers a one-time listener that is invoked when the tray balloon is clicked. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
once(event: "balloon-click", listener: () => void): this;
/**
* Registers a one-time listener that is invoked when the tray balloon is closed because of timeout or user manually closes it. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
once(event: "balloon-closed", listener: () => void): this;
/**
* Registers a one-time listener that is invoked when the tray balloon shows. `win32` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
once(event: "balloon-show", listener: () => void): this;
/**
* Registers a one-time listener that is invoked when the tray icon is clicked.
*
* @param event - The event name.
* @param listener - The event handler receiving the event, the bounds of the tray icon, and the position of the event.
* @returns This tray instance.
*/
once(event: "click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): this;
/**
* Registers a one-time listener that is invoked when the tray icon is double clicked. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the bounds of the tray icon.
* @returns This tray instance.
*/
once(event: "double-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this;
/**
* Registers a one-time listener that is invoked when a drag operation ends on the tray or ends at another location. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
once(event: "drag-end", listener: () => void): this;
/**
* Registers a one-time listener that is invoked when a drag operation enters the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
once(event: "drag-enter", listener: () => void): this;
/**
* Registers a one-time listener that is invoked when a drag operation exits the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
once(event: "drag-leave", listener: () => void): this;
/**
* Registers a one-time listener that is invoked when any dragged items are dropped on the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler.
* @returns This tray instance.
*/
once(event: "drop", listener: () => void): this;
/**
* Registers a one-time listener that is invoked when dragged files are dropped in the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the paths of the dropped files.
* @returns This tray instance.
*/
once(event: "drop-files", listener: (event: ElectronEvent, files: string[]) => void): this;
/**
* Registers a one-time listener that is invoked when dragged text is dropped in the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the dropped text string.
* @returns This tray instance.
*/
once(event: "drop-text", listener: (event: ElectronEvent, text: string) => void): this;
/**
* Registers a one-time listener that is invoked when the mouse clicks the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
once(event: "mouse-down", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a one-time listener that is invoked when the mouse enters the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
once(event: "mouse-enter", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a one-time listener that is invoked when the mouse exits the tray icon. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
once(event: "mouse-leave", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a one-time listener that is invoked when the mouse moves in the tray icon. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
once(event: "mouse-move", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a one-time listener that is invoked when the mouse is released from clicking the tray icon.
*
* Note: This will not be emitted if you have set a context menu for your tray using {@link ElectronTray.setContextMenu}, as a result of macOS-level constraints. `darwin` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the position of the event.
* @returns This tray instance.
*/
once(event: "mouse-up", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Registers a one-time listener that is invoked when the tray icon is right clicked. `darwin` and `win32` only.
*
* @param event - The event name.
* @param listener - The event handler receiving the event and the bounds of the tray icon.
* @returns This tray instance.
*/
once(event: "right-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this;
/**
* Pops up the context menu of the tray icon. When `menu` is passed, the `menu` will be shown instead of the tray icon's context menu.
*
* The `position` is only available on Windows, and it is (0, 0) by default. `darwin` and `win32` only.
*
* @param menu - The menu to show instead of the tray icon's context menu.
* @param position - The position at which to pop up the menu.
*/
popUpContextMenu(menu?: ElectronMenu, position?: ElectronPoint): void;
/**
* Removes a tray balloon. `win32` only.
*/
removeBalloon(): void;
/**
* Removes the event listener for the tray balloon being clicked.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "balloon-click", listener: () => void): this;
/**
* Removes the event listener for the tray balloon being closed.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "balloon-closed", listener: () => void): this;
/**
* Removes the event listener for the tray balloon being shown.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "balloon-show", listener: () => void): this;
/**
* Removes the event listener for the tray icon being clicked.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle, position: ElectronPoint) => void): this;
/**
* Removes the event listener for the tray icon being double clicked.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "double-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this;
/**
* Removes the event listener for a drag operation ending.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "drag-end", listener: () => void): this;
/**
* Removes the event listener for a drag operation entering the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "drag-enter", listener: () => void): this;
/**
* Removes the event listener for a drag operation exiting the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "drag-leave", listener: () => void): this;
/**
* Removes the event listener for dragged items being dropped on the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "drop", listener: () => void): this;
/**
* Removes the event listener for dragged files being dropped in the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "drop-files", listener: (event: ElectronEvent, files: string[]) => void): this;
/**
* Removes the event listener for dragged text being dropped in the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "drop-text", listener: (event: ElectronEvent, text: string) => void): this;
/**
* Removes the event listener for the mouse clicking the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "mouse-down", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Removes the event listener for the mouse entering the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "mouse-enter", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Removes the event listener for the mouse exiting the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "mouse-leave", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Removes the event listener for the mouse moving in the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "mouse-move", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Removes the event listener for the mouse being released from clicking the tray icon.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "mouse-up", listener: (event: ElectronKeyboardEvent, position: ElectronPoint) => void): this;
/**
* Removes the event listener for the tray icon being right clicked.
*
* @param event - The event name.
* @param listener - The event handler to remove.
* @returns This tray instance.
*/
removeListener(event: "right-click", listener: (event: ElectronKeyboardEvent, bounds: ElectronRectangle) => void): this;
/** Sets the context menu for this icon. */
setContextMenu(menu: ElectronMenu | null): void;
/**
* Sets the option to ignore double click events. Ignoring these events allows you to detect every individual click of the tray icon. `darwin` only.
*
* @param ignore - Whether to ignore double click events.
*/
setIgnoreDoubleClickEvents(ignore: boolean): void;
/**
* Sets the `image` associated with this tray icon.
*
* @param image - The image to use as the tray icon.
*/
setImage(image: ElectronNativeImage | string): void;
/**
* Sets the `image` associated with this tray icon when pressed on macOS. `darwin` only.
*
* @param image - The image to use as the pressed tray icon.
*/
setPressedImage(image: ElectronNativeImage | string): void;
/**
* Sets the title displayed next to the tray icon in the status bar (Support ANSI colors). `darwin` only.
*
* @param title - The title to display next to the tray icon.
* @param options - Options describing how the title is displayed.
*/
setTitle(title: string, options?: ElectronTitleOptions): void;
/**
* Sets the hover text for this tray icon.
*
* @param toolTip - The hover text for this tray icon.
*/
setToolTip(toolTip: string): void;
}
/**
* Graphics class for drawing shapes.
*
* @public
* @unofficial
*/
export declare class Graphics extends Container {
/**
* Creates a new graphics object.
*
* @param geometry - The geometry to use.
*/
constructor(geometry?: GraphicsGeometry);
/**
* Draws an arc.
*
* @param cx - Center X.
* @param cy - Center Y.
* @param radius - Arc radius.
* @param startAngle - Start angle in radians.
* @param endAngle - End angle in radians.
* @param anticlockwise - Whether to draw anticlockwise.
* @returns This graphics for chaining.
*/
arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): this;
/**
* Draws an arc between two tangent lines.
*
* @param x1 - First point X.
* @param y1 - First point Y.
* @param x2 - Second point X.
* @param y2 - Second point Y.
* @param radius - Arc radius.
* @returns This graphics for chaining.
*/
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this;
/**
* Begins filling a shape with color.
*
* @param color - Fill color.
* @param alpha - Fill alpha.
* @returns This graphics for chaining.
*/
beginFill(color?: ColorSource, alpha?: number): this;
/**
* Draws a cubic bezier curve.
*
* @param cpX - First control point X.
* @param cpY - First control point Y.
* @param cpX2 - Second control point X.
* @param cpY2 - Second control point Y.
* @param toX - End point X.
* @param toY - End point Y.
* @returns This graphics for chaining.
*/
bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): this;
/** Clears all drawn graphics. */
clear(): this;
/** Clones this graphics object. */
clone(): Graphics;
/** Closes the current path. */
closePath(): this;
/**
* Destroys this graphics object.
*
* @param options - Destroy options.
*/
destroy(options?: boolean | IDestroyOptions): void;
/**
* Draws a circle.
*
* @param x - Center X.
* @param y - Center Y.
* @param radius - Circle radius.
* @returns This graphics for chaining.
*/
drawCircle(x: number, y: number, radius: number): this;
/**
* Draws an ellipse.
*
* @param x - Center X.
* @param y - Center Y.
* @param width - Half width.
* @param height - Half height.
* @returns This graphics for chaining.
*/
drawEllipse(x: number, y: number, width: number, height: number): this;
/**
* Draws a rectangle.
*
* @param x - X position.
* @param y - Y position.
* @param width - Width.
* @param height - Height.
* @returns This graphics for chaining.
*/
drawRect(x: number, y: number, width: number, height: number): this;
/**
* Draws a rounded rectangle.
*
* @param x - X position.
* @param y - Y position.
* @param width - Width.
* @param height - Height.
* @param radius - Corner radius.
* @returns This graphics for chaining.
*/
drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): this;
/** Ends filling a shape. */
endFill(): this;
/**
* Sets the line style.
*
* @param width - Line width.
* @param color - Line color.
* @param alpha - Line alpha.
* @param alignment - Line alignment.
* @param native - Whether to use native line drawing.
* @returns This graphics for chaining.
*/
lineStyle(width: number, color?: ColorSource, alpha?: number, alignment?: number, native?: boolean): this;
/**
* Draws a line to a point.
*
* @param x - X coordinate.
* @param y - Y coordinate.
* @returns This graphics for chaining.
*/
lineTo(x: number, y: number): this;
/**
* Moves the drawing cursor to a point.
*
* @param x - X coordinate.
* @param y - Y coordinate.
* @returns This graphics for chaining.
*/
moveTo(x: number, y: number): this;
/**
* Draws a quadratic bezier curve.
*
* @param cpX - Control point X.
* @param cpY - Control point Y.
* @param toX - End point X.
* @param toY - End point Y.
* @returns This graphics for chaining.
*/
quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this;
/** Tint color. */
get tint(): ColorSource;
// eslint-disable-next-line jsdoc/require-jsdoc -- Doc comment must be on getter per api-extractor.
set tint(value: ColorSource);
}
/**
* Graphics geometry.
*
* @public
* @unofficial
*/
export declare class GraphicsGeometry {
/**
* Create new instance of {@link GraphicsGeometry}.
*
* @param options - Options.
*/
constructor();
}
/**
* Outline representing a PDF text highlight annotation.
*
* @public
* @unofficial
*/
export declare class HighlightOutline extends Outline {
/**
* The last point of the highlight used for directional calculations.
*/
lastPoint: unknown;
/**
* Create a highlight outline from the given outlines, bounding box, and last point.
*/
constructor(outlines: unknown, box: unknown, lastPoint: unknown);
/**
* The bounding box of the highlight outline.
*
* @returns The bounding box, or `null`.
*/
get box(): null | object;
/**
* CSS class names applied when outlining this highlight.
*
* @returns The class names for outlining.
*/
get classNamesForOutlining(): string[];
/**
* Serialize the outlines into the PDF page coordinate system.
*
* @param bbox - the bounding box of the annotation.
* @param rotation - the rotation of the annotation.
* @returns Serialized outlines.
*/
serialize(bbox: [
blX: string,
blY: string,
trX: string,
trY: string
], rotation: number): Array>;
}
/**
* Generates outlines around highlighted regions in a PDF document.
*
* @public
* @unofficial
*/
export declare class HighlightOutliner {
/**
* Construct an outliner.
*
* @param boxes - An array of axis-aligned rectangles.
* @param borderWidth - The width of the border of the boxes, it.
* allows to make the boxes bigger (or smaller).
* @param innerMargin - The margin between the boxes and the.
* outlines. It's important to not have a `null` innerMargin when we want to.
* draw the outline else the stroked outline could be clipped because of its.
* width.
* @param isLTR - `true` if we're in LTR mode. It's used to determine.
* the last point of the boxes.
*/
constructor(boxes: Array