karma-nightmare
Version:
A Karma plugin. Launcher for Nightmare
919 lines (897 loc) • 308 kB
TypeScript
// Type definitions for Electron 9.9.9
// Project: http://electron.atom.io/
// 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 EventEmitter {
public addListener(event: string, listener: Function): this;
public on(event: string, listener: Function): this;
public once(event: string, listener: Function): this;
public removeListener(event: string, listener: Function): this;
public removeAllListeners(event?: string): this;
public setMaxListeners(n: number): this;
public getMaxListeners(): number;
public listeners(event: string): Function[];
public emit(event: string, ...args: any[]): boolean;
public listenerCount(type: string): number;
public prependListener(event: string, listener: Function): this;
public prependOnceListener(event: string, listener: Function): this;
public eventNames(): string[];
}
class Accelerator extends String {
}
interface Event extends GlobalEvent {
preventDefault: () => void;
sender: WebContents;
returnValue: any;
ctrlkey?: boolean;
metaKey?: boolean;
shiftKey?: boolean;
}
interface CommonInterface {
clipboard: Electron.Clipboard;
crashReporter: Electron.CrashReporter;
nativeImage: typeof Electron.NativeImage;
screen: Electron.Screen;
shell: Electron.Shell;
}
interface MainInterface extends CommonInterface {
app: Electron.App;
autoUpdater: Electron.AutoUpdater;
BrowserWindow: typeof Electron.BrowserWindow;
ClientRequest: typeof Electron.ClientRequest;
contentTracing: Electron.ContentTracing;
Cookies: typeof Electron.Cookies;
Debugger: typeof Electron.Debugger;
dialog: Electron.Dialog;
DownloadItem: typeof Electron.DownloadItem;
globalShortcut: Electron.GlobalShortcut;
IncomingMessage: typeof Electron.IncomingMessage;
ipcMain: Electron.IpcMain;
Menu: typeof Electron.Menu;
MenuItem: typeof Electron.MenuItem;
net: Electron.Net;
powerMonitor: Electron.PowerMonitor;
powerSaveBlocker: Electron.PowerSaveBlocker;
protocol: Electron.Protocol;
session: typeof Electron.Session;
systemPreferences: Electron.SystemPreferences;
TouchBar: typeof Electron.TouchBar;
Tray: typeof Electron.Tray;
webContents: typeof Electron.WebContents;
WebRequest: typeof Electron.WebRequest;
}
interface RendererInterface extends CommonInterface {
BrowserWindowProxy: typeof Electron.BrowserWindowProxy;
desktopCapturer: Electron.DesktopCapturer;
ipcRenderer: Electron.IpcRenderer;
remote: Electron.Remote;
webFrame: Electron.WebFrame;
webviewTag: Electron.WebviewTag;
}
interface AllElectron {
app: Electron.App;
autoUpdater: Electron.AutoUpdater;
BrowserWindow: typeof Electron.BrowserWindow;
BrowserWindowProxy: typeof Electron.BrowserWindowProxy;
ClientRequest: typeof Electron.ClientRequest;
clipboard: Electron.Clipboard;
contentTracing: Electron.ContentTracing;
Cookies: typeof Electron.Cookies;
crashReporter: Electron.CrashReporter;
Debugger: typeof Electron.Debugger;
desktopCapturer: Electron.DesktopCapturer;
dialog: Electron.Dialog;
DownloadItem: typeof Electron.DownloadItem;
globalShortcut: Electron.GlobalShortcut;
IncomingMessage: typeof Electron.IncomingMessage;
ipcMain: Electron.IpcMain;
ipcRenderer: Electron.IpcRenderer;
Menu: typeof Electron.Menu;
MenuItem: typeof Electron.MenuItem;
nativeImage: typeof Electron.NativeImage;
net: Electron.Net;
powerMonitor: Electron.PowerMonitor;
powerSaveBlocker: Electron.PowerSaveBlocker;
protocol: Electron.Protocol;
remote: Electron.Remote;
screen: Electron.Screen;
session: typeof Electron.Session;
shell: Electron.Shell;
systemPreferences: Electron.SystemPreferences;
TouchBar: typeof Electron.TouchBar;
Tray: typeof Electron.Tray;
webContents: typeof Electron.WebContents;
webFrame: Electron.WebFrame;
WebRequest: typeof Electron.WebRequest;
webviewTag: Electron.WebviewTag;
}
interface App extends EventEmitter {
// Docs: http://electron.atom.io/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.
*/
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.
*/
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 before the application starts closing its windows. Calling
* event.preventDefault() will prevent the default behaviour, 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.
*/
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.
*/
on(event: 'continue-activity', listener: (event?: Event,
/**
* A string identifying the activity. Maps to .
*/
type?: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo?: any) => void): this;
once(event: 'continue-activity', listener: (event?: Event,
/**
* A string identifying the activity. Maps to .
*/
type?: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo?: any) => void): this;
addListener(event: 'continue-activity', listener: (event?: Event,
/**
* A string identifying the activity. Maps to .
*/
type?: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo?: any) => void): this;
removeListener(event: 'continue-activity', listener: (event?: Event,
/**
* A string identifying the activity. Maps to .
*/
type?: string,
/**
* Contains app-specific state stored by the activity on another device.
*/
userInfo?: any) => void): 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.
*/
on(event: 'login', listener: (event?: Event,
webContents?: WebContents,
request?: Request,
authInfo?: AuthInfo,
callback?: (username?: string, password?: string) => void) => void): this;
once(event: 'login', listener: (event?: Event,
webContents?: WebContents,
request?: Request,
authInfo?: AuthInfo,
callback?: (username?: string, password?: string) => void) => void): this;
addListener(event: 'login', listener: (event?: Event,
webContents?: WebContents,
request?: Request,
authInfo?: AuthInfo,
callback?: (username?: string, password?: string) => void) => void): this;
removeListener(event: 'login', listener: (event?: Event,
webContents?: WebContents,
request?: Request,
authInfo?: AuthInfo,
callback?: (username?: string, password?: string) => void) => 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.
*/
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.
*/
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.
*/
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?: any) => void): this;
once(event: 'ready', listener: (launchInfo?: any) => void): this;
addListener(event: 'ready', listener: (launchInfo?: any) => void): this;
removeListener(event: 'ready', listener: (launchInfo?: any) => 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 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 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 just 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.
*/
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 task bar, and on macOS you can visit it
* from dock menu.
*/
addRecentDocument(path: string): void;
/**
* Clears the recent documents list.
*/
clearRecentDocuments(): void;
/**
* Disables hardware acceleration for current app. This method can only be called
* before app is ready.
*/
disableHardwareAcceleration(): void;
/**
* Exits immediately with exitCode. exitCode defaults to 0. All windows will be
* closed immediately without asking user and the before-quit and will-quit events
* will not be emitted.
*/
exit(exitCode?: number): void;
/**
* On Linux, focuses on the first visible window. On macOS, makes the application
* the active app. On Windows, focuses on the application's first window.
*/
focus(): void;
getAppPath(): string;
getBadgeCount(): number;
getCurrentActivityType(): string;
/**
* Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux
* and macOS, icons depend on the application associated with file mime type.
*/
getFileIcon(path: string, callback: (error?: Error, icon?: NativeImage) => void): void;
/**
* Fetches a path's associated icon. On Windows, there a 2 kinds of icons: On Linux
* and macOS, icons depend on the application associated with file mime type.
*/
getFileIcon(path: string, options: FileIconOptions, callback: (error?: Error, icon?: NativeImage) => void): void;
getJumpListSettings(): JumpListSettings;
/**
* Note: When distributing your packaged app, you have to also ship the locales
* folder. Note: On Windows you have to call it after the ready events gets
* emitted.
*/
getLocale(): string;
/**
* If you provided path and args options to app.setLoginItemSettings then you need
* to pass the same arguments here for openAtLogin to be set correctly. Note: This
* API has no effect on MAS builds.
*/
getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
/**
* Usually the name field of package.json is a short lowercased name, according to
* the npm modules spec. You should usually also specify a productName field, which
* is your application's full capitalized name, and which will be preferred over
* name by Electron.
*/
getName(): string;
/**
* You can request the following paths by the name:
*/
getPath(name: string): string;
getVersion(): string;
/**
* Hides all application windows without minimizing them.
*/
hide(): void;
/**
* Imports the certificate in pkcs12 format into the platform certificate store.
* callback is called with the result of import operation, a value of 0 indicates
* success while any other value indicates failure according to chromium
* net_error_list.
*/
importCertificate(options: ImportCertificateOptions, callback: (result?: number) => void): void;
isAccessibilitySupportEnabled(): boolean;
/**
* This method checks if the current executable is the default handler for a
* protocol (aka URI scheme). If so, it will return true. Otherwise, it will return
* false. Note: On macOS, you can use this method to check if the app has been
* registered as the default protocol handler for a protocol. You can also verify
* this by checking ~/Library/Preferences/com.apple.LaunchServices.plist on the
* macOS machine. Please refer to Apple's documentation for details. The API uses
* the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
*/
isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
isReady(): boolean;
isUnityRunning(): boolean;
/**
* This method makes your application a Single Instance Application - instead of
* allowing multiple instances of your app to run, this will ensure that only a
* single instance of your app is running, and other instances signal this instance
* and exit. callback will be called with callback(argv, workingDirectory) when a
* second instance has been executed. 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. The callback is guaranteed to be executed after the ready event
* of app gets emitted. This method returns false if your process is the primary
* instance of the application and your app should continue loading. And returns
* true if your process has sent its parameters to another instance, and you should
* immediately quit. On macOS the system enforces single instance automatically
* when users try to open a second instance of your app in Finder, and the
* open-file and open-url events will be emitted for that. However when users start
* your app in command line the system's single instance mechanism will be bypassed
* and you have to use this method to ensure single instance. An example of
* activating the window of primary instance when a second instance starts:
*/
makeSingleInstance(callback: (argv?: string[], workingDirectory?: string) => void): void;
/**
* Try to close all windows. The before-quit event will be emitted first. If all
* windows are successfully closed, the will-quit event will be emitted and by
* default the application will terminate. This method guarantees that all
* beforeunload and unload event handlers are correctly executed. It is possible
* that a window cancels the quitting by returning false in the beforeunload event
* handler.
*/
quit(): void;
/**
* Relaunches the app when current instance exits. By default the new instance will
* use the same working directory and command line arguments with current instance.
* When args is specified, the args will be passed as command line arguments
* instead. When execPath is specified, the execPath will be executed for relaunch
* instead of current app. Note that this method does not quit the app when
* executed, you have to call app.quit or app.exit after calling app.relaunch to
* make the app restart. When app.relaunch is called for multiple times, multiple
* instances will be started after current instance exited. An example of
* restarting current instance immediately and adding a new command line argument
* to the new instance:
*/
relaunch(options?: RelaunchOptions): void;
/**
* Releases all locks that were created by makeSingleInstance. This will allow
* multiple instances of the application to once again run side by side.
*/
releaseSingleInstance(): void;
/**
* This method checks if the current executable as the default handler for a
* protocol (aka URI scheme). If so, it will remove the app as the default handler.
*/
removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
/**
* Set the about panel options. This will override the values defined in the app's
* .plist file. See the Apple docs for more details.
*/
setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
/**
* Changes the Application User Model ID to id.
*/
setAppUserModelId(id: string): void;
/**
* This method sets the current executable as the default handler for a protocol
* (aka URI scheme). It allows you to integrate your app deeper into the operating
* system. Once registered, all links with your-protocol:// will be opened with the
* current executable. The whole link, including protocol, will be passed to your
* application as a parameter. On Windows you can provide optional parameters path,
* the path to your executable, and args, an array of arguments to be passed to
* your executable when it launches. Note: On macOS, you can only register
* protocols that have been added to your app's info.plist, which can not be
* modified at runtime. You can however change the file with a simple text editor
* or script during build time. Please refer to Apple's documentation for details.
* The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme
* internally.
*/
setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
/**
* Sets the counter badge for current app. Setting the count to 0 will hide the
* badge. On macOS it shows on the dock icon. On Linux it only works for Unity
* launcher, Note: Unity launcher requires the existence of a .desktop file to
* work, for more information please read Desktop Environment Integration.
*/
setBadgeCount(count: number): boolean;
/**
* Sets or removes a custom Jump List for the application, and returns one of the
* following strings: If categories is null the previously set custom Jump List (if
* any) will be replaced by the standard Jump List for the app (managed by
* Windows). Note: If a JumpListCategory object has neither the type nor the name
* property set then its type is assumed to be tasks. If the name property is set
* but the type property is omitted then the type is assumed to be custom. Note:
* Users can remove items from custom categories, and Windows will not allow a
* removed item to be added back into a custom category until after the next
* successful call to app.setJumpList(categories). Any attempt to re-add a removed
* item to a custom category earlier than that will result in the entire custom
* category being omitted from the Jump List. The list of removed items can be
* obtained using app.getJumpListSettings(). Here's a very simple example of
* creating a custom Jump List:
*/
setJumpList(categories: JumpListCategory[]): void;
/**
* Set the app's login item settings. To work with Electron's autoUpdater on
* Windows, which uses Squirrel, you'll want to set the launch path to Update.exe,
* and pass arguments that specify your application name. For example: Note: This
* API has no effect on MAS builds.
*/
setLoginItemSettings(settings: Settings, path?: string, args?: string[]): void;
/**
* Overrides the current application's name.
*/
setName(name: string): void;
/**
* Overrides the path to a special directory or file associated with name. If the
* path specifies a directory that does not exist, the directory will be created by
* this method. On failure an Error is thrown. You can only override paths of a
* name defined in app.getPath. By default, web pages' cookies and caches will be
* stored under the userData directory. If you want to change this location, you
* have to override the userData path before the ready event of the app module is
* emitted.
*/
setPath(name: string, path: string): void;
/**
* Creates an NSUserActivity and sets it as the current activity. The activity is
* eligible for Handoff to another device afterward.
*/
setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
/**
* Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array
* of Task objects. Note: If you'd like to customize the Jump List even more use
* app.setJumpList(categories) instead.
*/
setUserTasks(tasks: Task[]): boolean;
/**
* Shows application windows after they were hidden. Does not automatically focus
* them.
*/
show(): void;
commandLine?: CommandLine;
dock?: Dock;
}
interface AutoUpdater extends EventEmitter {
// Docs: http://electron.atom.io/docs/api/auto-updater
/**
* Emitted when checking if an update has started.
*/
on(event: 'checking-for-update', listener: Function): this;
once(event: 'checking-for-update', listener: Function): this;
addListener(event: 'checking-for-update', listener: Function): this;
removeListener(event: 'checking-for-update', listener: Function): this;
/**
* Emitted when there is an error while updating.
*/
on(event: 'error', listener: (error?: Error) => void): this;
once(event: 'error', listener: (error?: Error) => void): this;
addListener(event: 'error', listener: (error?: Error) => void): this;
removeListener(event: 'error', listener: (error?: Error) => void): this;
/**
* Emitted when there is an available update. The update is downloaded
* automatically.
*/
on(event: 'update-available', listener: Function): this;
once(event: 'update-available', listener: Function): this;
addListener(event: 'update-available', listener: Function): this;
removeListener(event: 'update-available', listener: Function): this;
/**
* Emitted when an update has been downloaded. On Windows only releaseName is
* available.
*/
on(event: 'update-downloaded', listener: (event?: Event,
releaseNotes?: string,
releaseName?: string,
releaseDate?: Date,
updateURL?: string) => void): this;
once(event: 'update-downloaded', listener: (event?: Event,
releaseNotes?: string,
releaseName?: string,
releaseDate?: Date,
updateURL?: string) => void): this;
addListener(event: 'update-downloaded', listener: (event?: Event,
releaseNotes?: string,
releaseName?: string,
releaseDate?: Date,
updateURL?: string) => void): this;
removeListener(event: 'update-downloaded', listener: (event?: Event,
releaseNotes?: string,
releaseName?: string,
releaseDate?: Date,
updateURL?: string) => void): this;
/**
* Emitted when there is no available update.
*/
on(event: 'update-not-available', listener: Function): this;
once(event: 'update-not-available', listener: Function): this;
addListener(event: 'update-not-available', listener: Function): this;
removeListener(event: 'update-not-available', listener: Function): this;
/**
* Asks the server whether there is an update. You must call setFeedURL before
* using this API.
*/
checkForUpdates(): void;
getFeedURL(): string;
/**
* Restarts the app and installs the update after it has been downloaded. It should
* only be called after update-downloaded has been emitted. Note:
* autoUpdater.quitAndInstall() will close all application windows first and only
* emit before-quit event on app after that. This is different from the normal quit
* event sequence.
*/
quitAndInstall(): void;
/**
* Sets the url and initialize the auto updater.
*/
setFeedURL(url: string, requestHeaders?: any): void;
}
interface BluetoothDevice {
// Docs: http://electron.atom.io/docs/api/structures/bluetooth-device
deviceId?: string;
deviceName?: string;
}
class BrowserWindow extends EventEmitter {
// Docs: http://electron.atom.io/docs/api/browser-window
/**
* Emitted when an App Command is invoked. These are typically related to keyboard
* media keys or browser commands, as well as the "Back" button built into some
* mice on Windows. Commands are lowercased, underscores are replaced with hyphens,
* and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is
* emitted as browser-backward.
*/
public on(event: 'app-command', listener: (event?: Event,
command?: string) => void): this;
public once(event: 'app-command', listener: (event?: Event,
command?: string) => void): this;
public addListener(event: 'app-command', listener: (event?: Event,
command?: string) => void): this;
public removeListener(event: 'app-command', listener: (event?: Event,
command?: string) => void): this;
/**
* Emitted when the window loses focus.
*/
public on(event: 'blur', listener: Function): this;
public once(event: 'blur', listener: Function): this;
public addListener(event: 'blur', listener: Function): this;
public removeListener(event: 'blur', listener: Function): this;
/**
* Emitted when the window is going to be closed. It's emitted before the
* beforeunload and unload event of the DOM. Calling event.preventDefault() will
* cancel the close. Usually you would want to use the beforeunload handler to
* decide whether the window should be closed, which will also be called when the
* window is reloaded. In Electron, returning any value other than undefined would
* cancel the close. For example:
*/
public on(event: 'close', listener: (event?: Event) => void): this;
public once(event: 'close', listener: (event?: Event) => void): this;
public addListener(event: 'close', listener: (event?: Event) => void): this;
public removeListener(event: 'close', listener: (event?: Event) => void): this;
/**
* Emitted when the window is closed. After you have received this event you should
* remove the reference to the window and avoid using it any more.
*/
public on(event: 'closed', listener: Function): this;
public once(event: 'closed', listener: Function): this;
public addListener(event: 'closed', listener: Function): this;
public removeListener(event: 'closed', listener: Function): this;
/**
* Emitted when the window enters a full-screen state.
*/
public on(event: 'enter-full-screen', listener: Function): this;
public once(event: 'enter-full-screen', listener: Function): this;
public addListener(event: 'enter-full-screen', listener: Function): this;
public removeListener(event: 'enter-full-screen', listener: Function): this;
/**
* Emitted when the window enters a full-screen state triggered by HTML API.
*/
public on(event: 'enter-html-full-screen', listener: Function): this;
public once(event: 'enter-html-full-screen', listener: Function): this;
public addListener(event: 'enter-html-full-screen', listener: Function): this;
public removeListener(event: 'enter-html-full-screen', listener: Function): this;
/**
* Emitted when the window gains focus.
*/
public on(event: 'focus', listener: Function): this;
public once(event: 'focus', listener: Function): this;
public addListener(event: 'focus', listener: Function): this;
public removeListener(event: 'focus', listener: Function): this;
/**
* Emitted when the window is hidden.
*/
public on(event: 'hide', listener: Function): this;
public once(event: 'hide', listener: Function): this;
public addListener(event: 'hide', listener: Function): this;
public removeListener(event: 'hide', listener: Function): this;
/**
* Emitted when the window leaves a full-screen state.
*/
public on(event: 'leave-full-screen', listener: Function): this;
public once(event: 'leave-full-screen', listener: Function): this;
public addListener(event: 'leave-full-screen', listener: Function): this;
public removeListener(event: 'leave-full-screen', listener: Function): this;
/**
* Emitted when the window leaves a full-screen state triggered by HTML API.
*/
public on(event: 'leave-html-full-screen', listener: Function): this;
public once(event: 'leave-html-full-screen', listener: Function): this;
public addListener(event: 'leave-html-full-screen', listener: Function): this;
public removeListener(event: 'leave-html-full-screen', listener: Function): this;
/**
* Emitted when window is maximized.
*/
public on(event: 'maximize', listener: Function): this;
public once(event: 'maximize', listener: Function): this;
public addListener(event: 'maximize', listener: Function): this;
public removeListener(event: 'maximize', listener: Function): this;
/**
* Emitted when the window is minimized.
*/
public on(event: 'minimize', listener: Function): this;
public once(event: 'minimize', listener: Function): this;
public addListener(event: 'minimize', listener: Function): this;
public removeListener(event: 'minimize', listener: Function): this;
/**
* Emitted when the window is being moved to a new position. Note: On macOS this
* event is just an alias of moved.
*/
public on(event: 'move', listener: Function): this;
public once(event: 'move', listener: Function): this;
public addListener(event: 'move', listener: Function): this;
public removeListener(event: 'move', listener: Function): this;
/**
* Emitted once when the window is moved to a new position.
*/
public on(event: 'moved', listener: Function): this;
public once(event: 'moved', listener: Function): this;
public addListener(event: 'moved', listener: Function): this;
public removeListener(event: 'moved', listener: Function): this;
/**
* Emitted when the document changed its title, calling event.preventDefault() will
* prevent the native window's title from changing.
*/
public on(event: 'page-title-updated', listener: (event?: Event,
title?: string) => void): this;
public once(event: 'page-title-updated', listener: (event?: Event,
title?: string) => void): this;
public addListener(event: 'page-title-updated', listener: (event?: Event,
title?: string) => void): this;
public removeListener(event: 'page-title-updated', listener: (event?: Event,
title?: string) => void): this;
/**
* Emitted when the web page has been rendered (while not being shown) and window
* can be displayed without a visual flash.
*/
public on(event: 'ready-to-show', listener: Function): this;
public once(event: 'ready-to-show', listener: Function): this;
public addListener(event: 'ready-to-show', listener: Function): this;
public removeListener(event: 'ready-to-show', listener: Function): this;
/**
* Emitted when the window is being resized.
*/
public on(event: 'resize', listener: Function): this;
public once(event: 'resize', listener: Function): this;
public addListener(event: 'resize', listener: Function): this;
public removeListener(event: 'resize', listener: Function): this;
/**
* Emitted when the unresponsive web page becomes responsive again.
*/
public on(event: 'responsive', listener: Function): this;
public once(event: 'responsive', listener: Function): this;
public addListener(event: 'responsive', listener: Function): this;
public removeListener(event: 'responsive',