electron
Version:
Build cross platform desktop apps with JavaScript, HTML, and CSS
837 lines (825 loc) • 529 kB
TypeScript
// Type definitions for Electron 7.1.8
// Project: http://electronjs.org/
// Definitions by: The Electron Team <https://github.com/electron/electron>
// Definitions: https://github.com/electron/electron-typescript-definitions
/// <reference types="node" />
type GlobalEvent = Event;
declare namespace Electron {
class Accelerator extends String {
}
interface CommonInterface {
app: App;
autoUpdater: AutoUpdater;
BrowserView: typeof BrowserView;
BrowserWindowProxy: typeof BrowserWindowProxy;
BrowserWindow: typeof BrowserWindow;
ClientRequest: typeof ClientRequest;
clipboard: Clipboard;
CommandLine: typeof CommandLine;
contentTracing: ContentTracing;
contextBridge: ContextBridge;
Cookies: typeof Cookies;
crashReporter: CrashReporter;
Debugger: typeof Debugger;
desktopCapturer: DesktopCapturer;
dialog: Dialog;
Dock: typeof Dock;
DownloadItem: typeof DownloadItem;
globalShortcut: GlobalShortcut;
inAppPurchase: InAppPurchase;
IncomingMessage: typeof IncomingMessage;
ipcMain: IpcMain;
ipcRenderer: IpcRenderer;
MenuItem: typeof MenuItem;
Menu: typeof Menu;
nativeImage: typeof NativeImage;
nativeTheme: NativeTheme;
netLog: NetLog;
net: Net;
Notification: typeof Notification;
powerMonitor: PowerMonitor;
powerSaveBlocker: PowerSaveBlocker;
protocol: Protocol;
remote: Remote;
screen: Screen;
session: typeof Session;
shell: Shell;
systemPreferences: SystemPreferences;
TouchBarButton: typeof TouchBarButton;
TouchBarColorPicker: typeof TouchBarColorPicker;
TouchBarGroup: typeof TouchBarGroup;
TouchBarLabel: typeof TouchBarLabel;
TouchBarPopover: typeof TouchBarPopover;
TouchBarScrubber: typeof TouchBarScrubber;
TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
TouchBarSlider: typeof TouchBarSlider;
TouchBarSpacer: typeof TouchBarSpacer;
TouchBar: typeof TouchBar;
Tray: typeof Tray;
webContents: typeof WebContents;
webFrame: WebFrame;
WebRequest: typeof WebRequest;
webviewTag: WebviewTag;
}
interface MainInterface extends CommonInterface {
}
interface RendererInterface extends CommonInterface {
}
interface AllElectron extends MainInterface, RendererInterface {}
const app: App;
const autoUpdater: AutoUpdater;
const clipboard: Clipboard;
const contentTracing: ContentTracing;
const contextBridge: ContextBridge;
const crashReporter: CrashReporter;
const desktopCapturer: DesktopCapturer;
const dialog: Dialog;
const globalShortcut: GlobalShortcut;
const inAppPurchase: InAppPurchase;
const ipcMain: IpcMain;
const ipcRenderer: IpcRenderer;
type nativeImage = NativeImage;
const nativeImage: typeof NativeImage;
const nativeTheme: NativeTheme;
const netLog: NetLog;
const net: Net;
const powerMonitor: PowerMonitor;
const powerSaveBlocker: PowerSaveBlocker;
const protocol: Protocol;
const remote: Remote;
const screen: Screen;
type session = Session;
const session: typeof Session;
const shell: Shell;
const systemPreferences: SystemPreferences;
type webContents = WebContents;
const webContents: typeof WebContents;
const webFrame: WebFrame;
const webviewTag: WebviewTag;
interface App extends NodeJS.EventEmitter {
// Docs: http://electronjs.org/docs/api/app
/**
* Emitted when Chrome's accessibility support changes. This event fires when
* assistive technologies, such as screen readers, are enabled or disabled. See
* https://www.chromium.org/developers/design-documents/accessibility for more
* details.
*
* @platform darwin,win32
*/
on(event: 'accessibility-support-changed', listener: (event: Event,
/**
* `true` when Chrome's accessibility support is enabled, `false` otherwise.
*/
accessibilitySupportEnabled: boolean) => void): this;
once(event: 'accessibility-support-changed', listener: (event: Event,
/**
* `true` when Chrome's accessibility support is enabled, `false` otherwise.
*/
accessibilitySupportEnabled: boolean) => void): this;
addListener(event: 'accessibility-support-changed', listener: (event: Event,
/**
* `true` when Chrome's accessibility support is enabled, `false` otherwise.
*/
accessibilitySupportEnabled: boolean) => void): this;
removeListener(event: 'accessibility-support-changed', listener: (event: Event,
/**
* `true` when Chrome's accessibility support is enabled, `false` otherwise.
*/
accessibilitySupportEnabled: boolean) => void): this;
/**
* Emitted when the application is activated. Various actions can trigger this
* event, such as launching the application for the first time, attempting to
* re-launch the application when it's already running, or clicking on the
* application's dock or taskbar icon.
*
* @platform darwin
*/
on(event: 'activate', listener: (event: Event,
hasVisibleWindows: boolean) => void): this;
once(event: 'activate', listener: (event: Event,
hasVisibleWindows: boolean) => void): this;
addListener(event: 'activate', listener: (event: Event,
hasVisibleWindows: boolean) => void): this;
removeListener(event: 'activate', listener: (event: Event,
hasVisibleWindows: boolean) => void): this;
/**
* Emitted during Handoff after an activity from this device was successfully
* resumed on another one.
*
* @platform darwin
*/
on(event: 'activity-was-continued', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
once(event: 'activity-was-continued', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
addListener(event: 'activity-was-continued', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
removeListener(event: 'activity-was-continued', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
/**
* Emitted before the application starts closing its windows. Calling
* `event.preventDefault()` will prevent the default behavior, which is terminating
* the application.
*
* **Note:** If application quit was initiated by `autoUpdater.quitAndInstall()`,
* then `before-quit` is emitted *after* emitting `close` event on all windows and
* closing them.
*
* **Note:** On Windows, this event will not be emitted if the app is closed due to
* a shutdown/restart of the system or a user logout.
*/
on(event: 'before-quit', listener: (event: Event) => void): this;
once(event: 'before-quit', listener: (event: Event) => void): this;
addListener(event: 'before-quit', listener: (event: Event) => void): this;
removeListener(event: 'before-quit', listener: (event: Event) => void): this;
/**
* Emitted when a browserWindow gets blurred.
*/
on(event: 'browser-window-blur', listener: (event: Event,
window: BrowserWindow) => void): this;
once(event: 'browser-window-blur', listener: (event: Event,
window: BrowserWindow) => void): this;
addListener(event: 'browser-window-blur', listener: (event: Event,
window: BrowserWindow) => void): this;
removeListener(event: 'browser-window-blur', listener: (event: Event,
window: BrowserWindow) => void): this;
/**
* Emitted when a new browserWindow is created.
*/
on(event: 'browser-window-created', listener: (event: Event,
window: BrowserWindow) => void): this;
once(event: 'browser-window-created', listener: (event: Event,
window: BrowserWindow) => void): this;
addListener(event: 'browser-window-created', listener: (event: Event,
window: BrowserWindow) => void): this;
removeListener(event: 'browser-window-created', listener: (event: Event,
window: BrowserWindow) => void): this;
/**
* Emitted when a browserWindow gets focused.
*/
on(event: 'browser-window-focus', listener: (event: Event,
window: BrowserWindow) => void): this;
once(event: 'browser-window-focus', listener: (event: Event,
window: BrowserWindow) => void): this;
addListener(event: 'browser-window-focus', listener: (event: Event,
window: BrowserWindow) => void): this;
removeListener(event: 'browser-window-focus', listener: (event: Event,
window: BrowserWindow) => void): this;
/**
* Emitted when failed to verify the `certificate` for `url`, to trust the
* certificate you should prevent the default behavior with
* `event.preventDefault()` and call `callback(true)`.
*/
on(event: 'certificate-error', listener: (event: Event,
webContents: WebContents,
url: string,
/**
* The error code
*/
error: string,
certificate: Certificate,
callback: (isTrusted: boolean) => void) => void): this;
once(event: 'certificate-error', listener: (event: Event,
webContents: WebContents,
url: string,
/**
* The error code
*/
error: string,
certificate: Certificate,
callback: (isTrusted: boolean) => void) => void): this;
addListener(event: 'certificate-error', listener: (event: Event,
webContents: WebContents,
url: string,
/**
* The error code
*/
error: string,
certificate: Certificate,
callback: (isTrusted: boolean) => void) => void): this;
removeListener(event: 'certificate-error', listener: (event: Event,
webContents: WebContents,
url: string,
/**
* The error code
*/
error: string,
certificate: Certificate,
callback: (isTrusted: boolean) => void) => void): this;
/**
* Emitted during Handoff when an activity from a different device wants to be
* resumed. You should call `event.preventDefault()` if you want to handle this
* event.
*
* A user activity can be continued only in an app that has the same developer Team
* ID as the activity's source app and that supports the activity's type. Supported
* activity types are specified in the app's `Info.plist` under the
* `NSUserActivityTypes` key.
*
* @platform darwin
*/
on(event: 'continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo: unknown) => void): this;
once(event: 'continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo: unknown) => void): this;
addListener(event: 'continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo: unknown) => void): this;
removeListener(event: 'continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo: unknown) => void): this;
/**
* Emitted during Handoff when an activity from a different device fails to be
* resumed.
*
* @platform darwin
*/
on(event: 'continue-activity-error', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* A string with the error's localized description.
*/
error: string) => void): this;
once(event: 'continue-activity-error', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* A string with the error's localized description.
*/
error: string) => void): this;
addListener(event: 'continue-activity-error', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* A string with the error's localized description.
*/
error: string) => void): this;
removeListener(event: 'continue-activity-error', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* A string with the error's localized description.
*/
error: string) => void): this;
/**
* Emitted when `desktopCapturer.getSources()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will make it return empty
* sources.
*/
on(event: 'desktop-capturer-get-sources', listener: (event: Event,
webContents: WebContents) => void): this;
once(event: 'desktop-capturer-get-sources', listener: (event: Event,
webContents: WebContents) => void): this;
addListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
webContents: WebContents) => void): this;
removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event,
webContents: WebContents) => void): this;
/**
* Emitted whenever there is a GPU info update.
*/
on(event: 'gpu-info-update', listener: Function): this;
once(event: 'gpu-info-update', listener: Function): this;
addListener(event: 'gpu-info-update', listener: Function): this;
removeListener(event: 'gpu-info-update', listener: Function): this;
/**
* Emitted when the GPU process crashes or is killed.
*/
on(event: 'gpu-process-crashed', listener: (event: Event,
killed: boolean) => void): this;
once(event: 'gpu-process-crashed', listener: (event: Event,
killed: boolean) => void): this;
addListener(event: 'gpu-process-crashed', listener: (event: Event,
killed: boolean) => void): this;
removeListener(event: 'gpu-process-crashed', listener: (event: Event,
killed: boolean) => void): this;
/**
* Emitted when `webContents` wants to do basic auth.
*
* The default behavior is to cancel all authentications. To override this you
* should prevent the default behavior with `event.preventDefault()` and call
* `callback(username, password)` with the credentials.
*
* If `callback` is called without a username or password, the authentication
* request will be cancelled and the authentication error will be returned to the
* page.
*/
on(event: 'login', listener: (event: Event,
webContents: WebContents,
authenticationResponseDetails: AuthenticationResponseDetails,
authInfo: AuthInfo,
callback: (username?: string, password?: string) => void) => void): this;
once(event: 'login', listener: (event: Event,
webContents: WebContents,
authenticationResponseDetails: AuthenticationResponseDetails,
authInfo: AuthInfo,
callback: (username?: string, password?: string) => void) => void): this;
addListener(event: 'login', listener: (event: Event,
webContents: WebContents,
authenticationResponseDetails: AuthenticationResponseDetails,
authInfo: AuthInfo,
callback: (username?: string, password?: string) => void) => void): this;
removeListener(event: 'login', listener: (event: Event,
webContents: WebContents,
authenticationResponseDetails: AuthenticationResponseDetails,
authInfo: AuthInfo,
callback: (username?: string, password?: string) => void) => void): this;
/**
* Emitted when the user clicks the native macOS new tab button. The new tab button
* is only visible if the current `BrowserWindow` has a `tabbingIdentifier`
*
* @platform darwin
*/
on(event: 'new-window-for-tab', listener: (event: Event) => void): this;
once(event: 'new-window-for-tab', listener: (event: Event) => void): this;
addListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
removeListener(event: 'new-window-for-tab', listener: (event: Event) => void): this;
/**
* Emitted when the user wants to open a file with the application. The `open-file`
* event is usually emitted when the application is already open and the OS wants
* to reuse the application to open the file. `open-file` is also emitted when a
* file is dropped onto the dock and the application is not yet running. Make sure
* to listen for the `open-file` event very early in your application startup to
* handle this case (even before the `ready` event is emitted).
*
* You should call `event.preventDefault()` if you want to handle this event.
*
* On Windows, you have to parse `process.argv` (in the main process) to get the
* filepath.
*
* @platform darwin
*/
on(event: 'open-file', listener: (event: Event,
path: string) => void): this;
once(event: 'open-file', listener: (event: Event,
path: string) => void): this;
addListener(event: 'open-file', listener: (event: Event,
path: string) => void): this;
removeListener(event: 'open-file', listener: (event: Event,
path: string) => void): this;
/**
* Emitted when the user wants to open a URL with the application. Your
* application's `Info.plist` file must define the URL scheme within the
* `CFBundleURLTypes` key, and set `NSPrincipalClass` to `AtomApplication`.
*
You should call `event.preventDefault()` if you want to handle this event.
*
* @platform darwin
*/
on(event: 'open-url', listener: (event: Event,
url: string) => void): this;
once(event: 'open-url', listener: (event: Event,
url: string) => void): this;
addListener(event: 'open-url', listener: (event: Event,
url: string) => void): this;
removeListener(event: 'open-url', listener: (event: Event,
url: string) => void): this;
/**
* Emitted when the application is quitting.
*
* **Note:** On Windows, this event will not be emitted if the app is closed due to
* a shutdown/restart of the system or a user logout.
*/
on(event: 'quit', listener: (event: Event,
exitCode: number) => void): this;
once(event: 'quit', listener: (event: Event,
exitCode: number) => void): this;
addListener(event: 'quit', listener: (event: Event,
exitCode: number) => void): this;
removeListener(event: 'quit', listener: (event: Event,
exitCode: number) => void): this;
/**
* Emitted when Electron has finished initializing. On macOS, `launchInfo` holds
* the `userInfo` of the `NSUserNotification` that was used to open the
* application, if it was launched from Notification Center. You can call
* `app.isReady()` to check if this event has already fired.
*/
on(event: 'ready', listener: (launchInfo: unknown) => void): this;
once(event: 'ready', listener: (launchInfo: unknown) => void): this;
addListener(event: 'ready', listener: (launchInfo: unknown) => void): this;
removeListener(event: 'ready', listener: (launchInfo: unknown) => void): this;
/**
* Emitted when `remote.getBuiltin()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the module from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-builtin', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
once(event: 'remote-get-builtin', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
addListener(event: 'remote-get-builtin', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
removeListener(event: 'remote-get-builtin', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
/**
* Emitted when `remote.getCurrentWebContents()` is called in the renderer process
* of `webContents`. Calling `event.preventDefault()` will prevent the object from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-current-web-contents', listener: (event: Event,
webContents: WebContents) => void): this;
once(event: 'remote-get-current-web-contents', listener: (event: Event,
webContents: WebContents) => void): this;
addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
webContents: WebContents) => void): this;
removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
webContents: WebContents) => void): this;
/**
* Emitted when `remote.getCurrentWindow()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the object from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-current-window', listener: (event: Event,
webContents: WebContents) => void): this;
once(event: 'remote-get-current-window', listener: (event: Event,
webContents: WebContents) => void): this;
addListener(event: 'remote-get-current-window', listener: (event: Event,
webContents: WebContents) => void): this;
removeListener(event: 'remote-get-current-window', listener: (event: Event,
webContents: WebContents) => void): this;
/**
* Emitted when `remote.getGlobal()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the global from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-global', listener: (event: Event,
webContents: WebContents,
globalName: string) => void): this;
once(event: 'remote-get-global', listener: (event: Event,
webContents: WebContents,
globalName: string) => void): this;
addListener(event: 'remote-get-global', listener: (event: Event,
webContents: WebContents,
globalName: string) => void): this;
removeListener(event: 'remote-get-global', listener: (event: Event,
webContents: WebContents,
globalName: string) => void): this;
/**
* Emitted when `<webview>.getWebContents()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the object from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-get-guest-web-contents', listener: (event: Event,
webContents: WebContents,
guestWebContents: WebContents) => void): this;
once(event: 'remote-get-guest-web-contents', listener: (event: Event,
webContents: WebContents,
guestWebContents: WebContents) => void): this;
addListener(event: 'remote-get-guest-web-contents', listener: (event: Event,
webContents: WebContents,
guestWebContents: WebContents) => void): this;
removeListener(event: 'remote-get-guest-web-contents', listener: (event: Event,
webContents: WebContents,
guestWebContents: WebContents) => void): this;
/**
* Emitted when `remote.require()` is called in the renderer process of
* `webContents`. Calling `event.preventDefault()` will prevent the module from
* being returned. Custom value can be returned by setting `event.returnValue`.
*/
on(event: 'remote-require', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
once(event: 'remote-require', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
addListener(event: 'remote-require', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
removeListener(event: 'remote-require', listener: (event: Event,
webContents: WebContents,
moduleName: string) => void): this;
/**
* Emitted when the renderer process of `webContents` crashes or is killed.
*/
on(event: 'renderer-process-crashed', listener: (event: Event,
webContents: WebContents,
killed: boolean) => void): this;
once(event: 'renderer-process-crashed', listener: (event: Event,
webContents: WebContents,
killed: boolean) => void): this;
addListener(event: 'renderer-process-crashed', listener: (event: Event,
webContents: WebContents,
killed: boolean) => void): this;
removeListener(event: 'renderer-process-crashed', listener: (event: Event,
webContents: WebContents,
killed: boolean) => void): this;
/**
* This event will be emitted inside the primary instance of your application when
* a second instance has been executed and calls `app.requestSingleInstanceLock()`.
*
* `argv` is an Array of the second instance's command line arguments, and
* `workingDirectory` is its current working directory. Usually applications
* respond to this by making their primary window focused and non-minimized.
*
* This event is guaranteed to be emitted after the `ready` event of `app` gets
* emitted.
*
* **Note:** Extra command line arguments might be added by Chromium, such as
* `--original-process-start-time`.
*/
on(event: 'second-instance', listener: (event: Event,
/**
* An array of the second instance's command line arguments
*/
argv: string[],
/**
* The second instance's working directory
*/
workingDirectory: string) => void): this;
once(event: 'second-instance', listener: (event: Event,
/**
* An array of the second instance's command line arguments
*/
argv: string[],
/**
* The second instance's working directory
*/
workingDirectory: string) => void): this;
addListener(event: 'second-instance', listener: (event: Event,
/**
* An array of the second instance's command line arguments
*/
argv: string[],
/**
* The second instance's working directory
*/
workingDirectory: string) => void): this;
removeListener(event: 'second-instance', listener: (event: Event,
/**
* An array of the second instance's command line arguments
*/
argv: string[],
/**
* The second instance's working directory
*/
workingDirectory: string) => void): this;
/**
* Emitted when a client certificate is requested.
*
* The `url` corresponds to the navigation entry requesting the client certificate
* and `callback` can be called with an entry filtered from the list. Using
* `event.preventDefault()` prevents the application from using the first
* certificate from the store.
*/
on(event: 'select-client-certificate', listener: (event: Event,
webContents: WebContents,
url: string,
certificateList: Certificate[],
callback: (certificate?: Certificate) => void) => void): this;
once(event: 'select-client-certificate', listener: (event: Event,
webContents: WebContents,
url: string,
certificateList: Certificate[],
callback: (certificate?: Certificate) => void) => void): this;
addListener(event: 'select-client-certificate', listener: (event: Event,
webContents: WebContents,
url: string,
certificateList: Certificate[],
callback: (certificate?: Certificate) => void) => void): this;
removeListener(event: 'select-client-certificate', listener: (event: Event,
webContents: WebContents,
url: string,
certificateList: Certificate[],
callback: (certificate?: Certificate) => void) => void): this;
/**
* Emitted when Electron has created a new `session`.
*/
on(event: 'session-created', listener: (session: Session) => void): this;
once(event: 'session-created', listener: (session: Session) => void): this;
addListener(event: 'session-created', listener: (session: Session) => void): this;
removeListener(event: 'session-created', listener: (session: Session) => void): this;
/**
* Emitted when Handoff is about to be resumed on another device. If you need to
* update the state to be transferred, you should call `event.preventDefault()`
* immediately, construct a new `userInfo` dictionary and call
* `app.updateCurrentActiviy()` in a timely manner. Otherwise, the operation will
* fail and `continue-activity-error` will be called.
*
* @platform darwin
*/
on(event: 'update-activity-state', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
once(event: 'update-activity-state', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
addListener(event: 'update-activity-state', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
removeListener(event: 'update-activity-state', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string,
/**
* Contains app-specific state stored by the activity.
*/
userInfo: unknown) => void): this;
/**
* Emitted when a new webContents is created.
*/
on(event: 'web-contents-created', listener: (event: Event,
webContents: WebContents) => void): this;
once(event: 'web-contents-created', listener: (event: Event,
webContents: WebContents) => void): this;
addListener(event: 'web-contents-created', listener: (event: Event,
webContents: WebContents) => void): this;
removeListener(event: 'web-contents-created', listener: (event: Event,
webContents: WebContents) => void): this;
/**
* Emitted during Handoff before an activity from a different device wants to be
* resumed. You should call `event.preventDefault()` if you want to handle this
* event.
*
* @platform darwin
*/
on(event: 'will-continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string) => void): this;
once(event: 'will-continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string) => void): this;
addListener(event: 'will-continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string) => void): this;
removeListener(event: 'will-continue-activity', listener: (event: Event,
/**
* A string identifying the activity. Maps to `NSUserActivity.activityType`.
*/
type: string) => void): this;
/**
* Emitted when the application has finished basic startup. On Windows and Linux,
* the `will-finish-launching` event is the same as the `ready` event; on macOS,
* this event represents the `applicationWillFinishLaunching` notification of
* `NSApplication`. You would usually set up listeners for the `open-file` and
* `open-url` events here, and start the crash reporter and auto updater.
*
In most cases, you should do everything in the `ready` event handler.
*/
on(event: 'will-finish-launching', listener: Function): this;
once(event: 'will-finish-launching', listener: Function): this;
addListener(event: 'will-finish-launching', listener: Function): this;
removeListener(event: 'will-finish-launching', listener: Function): this;
/**
* Emitted when all windows have been closed and the application will quit. Calling
* `event.preventDefault()` will prevent the default behaviour, which is
* terminating the application.
*
* See the description of the `window-all-closed` event for the differences between
* the `will-quit` and `window-all-closed` events.
*
* **Note:** On Windows, this event will not be emitted if the app is closed due to
* a shutdown/restart of the system or a user logout.
*/
on(event: 'will-quit', listener: (event: Event) => void): this;
once(event: 'will-quit', listener: (event: Event) => void): this;
addListener(event: 'will-quit', listener: (event: Event) => void): this;
removeListener(event: 'will-quit', listener: (event: Event) => void): this;
/**
* Emitted when all windows have been closed.
*
* If you do not subscribe to this event and all windows are closed, the default
* behavior is to quit the app; however, if you subscribe, you control whether the
* app quits or not. If the user pressed `Cmd + Q`, or the developer called
* `app.quit()`, Electron will first try to close all the windows and then emit the
* `will-quit` event, and in this case the `window-all-closed` event would not be
* emitted.
*/
on(event: 'window-all-closed', listener: Function): this;
once(event: 'window-all-closed', listener: Function): this;
addListener(event: 'window-all-closed', listener: Function): this;
removeListener(event: 'window-all-closed', listener: Function): this;
/**
* Adds `path` to the recent documents list.
*
* This list is managed by the OS. On Windows, you can visit the list from the tas