/** * Contains type definitions for the `fin` object which is preloaded by FEA (e2o.js). */ import { Manifest, StandardErrorCallback, StandardPromise } from "./types"; import { WindowTypes } from "./platform/services/window/types"; export type FEALogLevel = "error" | "warn" | "log" | "info" | "debug" | "verbose"; interface FEADesktop { main(f: () => any): void; InterApplicationBus: FEAInterApplicationBus; Notification: FEANotificationStatic; System: FEASystem; Window: FEAWindow; } export type FEAInfo = { Electron: string; FEA: string; isDevLaunch: boolean; sddEnabled: boolean; isDevMode: boolean; }; export type Rectangle = { height: number; width: number; x: number; y: number; }; export type WindowState = "normal" | "minimized" | "maximized" | "full-screen" | "kiosk" | "minimized_from_maximized"; /** * An event that updates the state of a window. If a value is non-null then it indicates that the * state has changed. * * Bounds is sent with all events except for "closed", regardless of whether it has changed or not. */ export type PhysicalWindowState = { windowName: string; open?: boolean; normalBounds: Rectangle; bounds: Rectangle; title?: string; isAlwaysOnTop?: boolean; visible?: boolean; windowState: WindowState; focused?: boolean; }; export type PhysicalWindowStateEvent = PhysicalWindowState & { eventName: string; }; interface SuccessObj { httpResponseCode: number; } interface NetworkErrorInfo extends ErrorInfo { networkErrorCode: number; } export interface ErrorInfo { stack: string; message: string; } export interface WindowOptions { /** * A flag to always position the window at the top of the window stack. Default: false. * Updatable */ alwaysOnTop?: boolean; /** * The arguments that were sent to the application */ arguments?: string; /** * A flag to automatically show the Window when it is created. Default: false. */ autoShow?: boolean; /** * The type of the component */ componentType?: string; /** * A flag to show the context menu when right-clicking on a window. Gives access to the Developer Console for the Window. Default: true * Updatable */ contextMenu?: boolean; /** * This defines and applies rounded corners for a frameless window. Default for both width and height: 0. * Updatable */ cornerRounding?: { width?: number; height?: number; }; /** * A field that the user can attach serializable data to to be ferried around with the window options. Default: ''. */ customData?: any; /** * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. * When the window corresponding to that id is loaded again, the position from before the window was closed is used. * This option overrides defaultLeft and defaultTop. Default: false. */ defaultCentered?: boolean; /** * The default height of the window. Specifies the height of the window when loaded for the first time on a machine. * When the window corresponding to that id is loaded again, the height is taken to be the last height of the window before it was closed. Default: 500. */ defaultHeight?: number; /** * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. * When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800. */ defaultWidth?: number; /** * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. * When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100. */ defaultTop?: number; /** * The default left position of the window. Specifies the position of the left of the window when loaded for the first time on a machine. * When the window corresponding to that id is loaded again, the value of left is taken to be the last value before the window was closed. Default: 100. */ defaultLeft?: number; /** * A flag to show the frame. Default: true. * Updatable */ frame?: boolean; /** * The window's current height */ height?: number; /** * A flag to allow a window to be hidden when the close button is clicked.Default: false. * Updatable */ hideOnClose?: boolean; /** * A URL for the icon to be shown in the window title bar and the taskbar.Default: The parent application's applicationIcon. * Updatable */ icon?: string; /** * The window's current left position */ left?: number; /** * The maximum height of a window.Will default to the OS defined value if set to - 1. Default: -1. * Updatable */ maxHeight?: number; /** * A flag that lets the window be maximized.Default: true. * Updatable */ maximizable?: boolean; /** * The maximum width of a window.Will default to the OS defined value if set to - 1. Default: -1. * Updatable */ maxWidth?: number; /** * The minimum height of a window.Default: 0. * Updatable */ minHeight?: number; /** * A flag that lets the window be minimized.Default: true. */ minimizable?: boolean; /** * The minimum width of a window.Default: 0. */ minWidth?: number; /** * The name for the window which must be unique within the context of the invoking Application. */ name?: string; /** * A flag that specifies how transparent the window will be.This value is clamped between 0.0 and 1.0.Default: 1.0. * Updatable */ opacity?: number; /** * The path to the application when windowType is "external", "native" or "assimilation". */ path?: string; /** * A flag to drop to allow the user to resize the window.Default: true. * Updatable */ resizable?: boolean; /** * Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. * Updatable */ resizeRegion?: { /** * The size in pixels (Default: 2), */ size?: number; /** * The size in pixels of an additional * square resizable region located at the * bottom right corner of a * frameless window. (Default: 4) */ bottomRightCorner?: number; }; /** * A flag to show the Window's icon in the taskbar. Default: true. */ showTaskbarIcon?: boolean; /** * A flag to cache the location of the window or not. Default: true. */ saveWindowState?: boolean; /** * Specify a taskbar group for the window. Default: app's uuid. */ taskbarIconGroup?: string; /** * The window's current top position */ top?: number; /** * Whether window should be shown */ show?: boolean; /** * A string that sets the window to be "minimized", "maximized", or "normal" on creation. Default: "normal". */ state?: string; /** * Makes the window transparent. */ transparent?: boolean; /** * Which the type window to spawn */ windowType?: WindowTypes; /** * The window's current width */ width?: number; /** * The URL of the window. Default: "about:blank". */ url?: string; /** * When set to false, the window will render before the "load" event is fired on the content's window. * Caution, when false you will see an initial empty white window. Default: true. */ waitForPageLoad?: boolean; /** * The url for the window's titlebar component. */ windowTitleBarUrl?: string; } /** * Clipboard * Clipboard API allows reading and writing to the clipboard in multiple formats. */ interface FEAClipboard { new (): FEAClipboard; /** * Creates a new Application. * An object representing an application. Allows the developer to create, execute, show/close an application as well as listen to application events. */ new (): FEAClipboard; /** * Reads available formats for the clipboard type */ availableFormats(type: string | null, callback?: (formats: string[]) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; /** * Reads available formats for the clipboard type */ readHTML(type: string | null, callback?: (html: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; /** * Read the content of the clipboard as Rtf */ readRTF(type: string | null, callback?: (rtf: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; /** * Read the content of the clipboard as plain text */ readText(type: string | null, callback?: (text: string) => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; /** * Writes data into the clipboard */ write(data: any, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; /** * Writes data into the clipboard as Html */ writeHTML(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; /** * Writes data into the clipboard as Rtf */ writeRTF(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; /** * Writes data into the clipboard as plain text */ writeText(data: string, type: string | null, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; } /** * InterApplicationBus * A messaging bus that allows for pub/sub messaging between different applications. */ export interface FEAInterApplicationBus { /** * Adds a listener that gets called when applications subscribe to the current application's messages. */ addSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; /** * Adds a listener that gets called when applications unsubscribe to the current application's messages. */ addUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; /** * Removes a previously registered subscribe listener. */ removeSubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; /** * Removes a previously registered unsubscribe listener. */ removeUnsubscribeListener(listener: (uuid: string, topic: string, name: string) => void): void; /** * Publishes a message to all applications running on FEA Runtime that are subscribed to the specified topic. */ publish(topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Sends a message to a specific application on a specific topic. */ send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], * topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published. * * Returns an id which can be passed to unsubscribe. */ subscribe(senderUuid: string, topic: string, listener: (message: any, uuid: string, name: string) => void, callback?: () => void, errorCallback?: (reason: string) => void): string | null; /** * Discontinues the subscription */ unsubscribe( /** * The return value from a previous call to subscribe() */ subscriptionID: string | null): void; } interface FEANotificationStatic { /** * Sends a system notification */ send(options: NotificationOptions): void; /** * Gets an instance of the current notification. For use within a notification window to close the window or send a message back to its parent application. */ getCurrent(): FEANotification; } /** * Notification * Notification represents a window on FEA Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor. * A notification is typically used to alert the user of some important event which requires his or her attention. * Notifications are a child or your application that are controlled by the runtime. */ interface FEANotification { /** * Closes the notification. */ close(callback?: () => void): void; /** * Sends a message to the notification. */ sendMessage(message: any, callback?: () => void): void; /** * Sends a message from the notification to the application that created the notification. The message is handled by the notification's onMessage callback. */ sendMessageToApplication(message: any, callback?: () => void): void; } export interface NotificationOptions { /** * A boolean that will force dismissal even if the mouse is hovering over the notification */ ignoreMouseOver?: boolean; /** * A message of any primitive or composite-primitive type to be passed to the notification upon creation. */ message?: any; /** * The timeout for displaying a notification.Can be in milliseconds or "never". */ duration?: number | "never"; /** * The url of the notification */ url?: string; /** * A function that is called when a notification is clicked. */ onClick?(callback: () => void): void; /** * Invoked when the notification is closed via .close() method on the created notification instance * or the by the notification itself via fin.desktop.Notification.getCurrent().close(). * NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss */ onClose?(callback: () => void): void; /** * Invoked when a the notification is dismissed by swiping it off the screen to the right. NOTE: this is no fired on a programmatic close. */ onDismiss?(callback: () => void): void; /** * A function that is called when an error occurs.The reason for the error is passed as an argument. */ onError?(errorCallback: (reason: string, errorObj: NetworkErrorInfo) => void): void; /** * The onMessage function will respond to messages sent from notification.sendMessageToApplication. * The function is passed the message, which can be of any primitive or composite-primitive type. */ onMessage?(callback: (message: any) => void): void; /** * A function that is called when a notification is shown. */ onShow?(callback: (successObj: SuccessObj) => void): void; } /** * System * An object representing the core of FEA Runtime. * Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime. */ interface FEASystem { Clipboard: FEAClipboard; GlobalShortcut: { register: (keys: string, cb: Function) => void; unregister: (keys: string) => void; }; addCertificateErrorListener(): any; /** * Registers an event listener on the specified event. */ addEventListener(type: FEASystemEventType, listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent | ProtocolHandlerEvent | UpdateDownloadEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; addSelectClientCertificateListener(): any; /** * Clears cached data containing window state/positions, * application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. */ clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): Promise; /** * Downloads the given application asset */ downloadAsset(assetObj: AppAssetInfo, progressListener?: (progress: { downloadedBytes: number; totalBytes: number; }) => void, callback?: (successObj: { path: string; }) => void, errorCallback?: (reason: string, errorObj: NetworkErrorInfo) => void): void; /** * Exits the Runtime. */ exit(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Get additional info of cookies. */ getCookies(option: CookieOption, callback?: (info: CookieInfo[]) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves the command line argument string that started FEA Runtime. */ getCommandLineArguments(callback?: (args: string) => void, errorCallback?: (reason: string) => void): void; /** * Gets the value of a given environment variable on the computer on which the runtime is installed. */ getEnvironmentVariable(envVar: string, callback?: (variable: string) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves the JSON manifest that was used to create the application. Invokes the error callback if the application was not created from a manifest. */ getManifest(callback?: (manifest: Manifest) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves smart desktop server info */ getSDServerInfo(callback?: (info: SDServerInfo) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves system information. */ getHostSpecs(callback?: (info: HostSpecInfo) => void, errorCallback?: (reason: string) => void): void; /** * Retrieves an object that contains data about the about the monitor setup of the computer that the runtime is running on. */ getMonitorInfo(callback?: (monitorInfo: MonitorInfo) => void, errorCallback?: (reason: string) => void): void; /** * Returns the mouse in virtual screen coordinates (left, top). */ getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void; /** * Deletes app assets * @param alias - If set, then delete that specific asset, otherwise delete all */ deleteAssets(alias?: string | null): StandardPromise; /** * Returns smart desktop server info */ getSDServerInfo(callback?: (info: Object) => void, errorCallback?: (err: string) => void): void; /** * Retrieves an array of all of the runtime processes that are currently running. * Each element in the array is an object containing the uuid and the name of the application to which the process belongs. */ getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void; getUpdateAvailable: (cb: (isUpdateAvailable: boolean) => void) => void; /** * Returns the version numbers of Electron and FEA. */ getFEAInfo(cb?: (versions: FEAInfo) => void): Promise; /** * @deprecated Use getFEAInfo */ getVersion(callback?: (version: string) => void, errorCallback?: (reason: string) => void): void; hideSplashScreen: () => void; notifyLoggerReady: () => void; updateCentralLoggerState: (loggerState: any) => void; /** * Runs an executable or batch file. */ launchExternalProcess(options: ExternalProcessLaunchInfo, callback?: (payload: { uuid: string; }) => void, errorCallback?: (reason: string) => void): void; /** * Sends a log message to the FEA log. This is only allowed if the app is running * under a security profile that has logToDisk set to true (such as the "trusted" profile.) * * @param level The log level to use * @param ...messages Messages to log */ logToDisk(level: FEALogLevel, ...messages: any[]): void; /** * Subscribes to the WindowEventStream. This is reserved for the window service. */ subscribeToWindowEventStream(handler: (data: PhysicalWindowStateEvent) => void): any; /** * Monitors a running process. */ monitorExternalProcess(options: ExternalProcessInfo, callback?: (payload: { uuid: string; }) => void, errorCallback?: (reason: string) => void): void; /** * Opens the passed URL in the default web browser. */ openUrlWithBrowser(url: string, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Gets list of downloads currently stored. */ getDownloadList(callback?: (downloadList: any) => void, errorCallback?: (reason: string) => void): void; /** * Removes a download from the list of downloads. */ removeDownloadItem(id: string): StandardPromise; /** * Cancels a download. */ cancelDownload(id: string): void; /** * Pauses a download. */ pauseDownload(id: string): void; /** * Resumes a paused download. */ resumeDownload(id: string): void; /** * Sets the location where downloads should be saved */ setDownloadSavePath(path: string): void; /** * Opens the folder where the download was saved */ showDownloadedFileInFolder(id: string): void; /** * Clears the download list for testing */ clearDownloadList(): void; /** * Removes a previously registered event listener from the specified event. */ removeEventListener(type: FEASystemEventType, listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent | ProtocolHandlerEvent | UpdateDownloadEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Restarts the entire application (FEA) */ restart(): void; setTrayIcon(url: string, cb?: () => void): void; /** * Shows the Chrome Developer Tools for the specified window. */ showDeveloperTools(name: string, /** Defaults to true. When true, automatically show developer tools for current window or view. Otherwise, specify the number of the explicit BrowserView, or null for the BrowserWindow */ isView?: number | boolean | null, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Performs handshake with FEA to indicate the primary application started successfully */ startupApplicationHandshake(): void; /** * Terminates the entire application (FEA) */ terminate(): void; /** * Attempt to close an external process. The process will be terminated if it has not closed after the elapsed timeout in milliseconds. */ terminateExternalProcess(processUuid: string, timeout: number, callback?: (info: { result: "clean" | "terminated" | "failed"; }) => void, errorCallback?: (reason: string) => void): void; getProtocolString(cb?: (data: string) => void): Promise; } export interface CacheOptions { cache?: boolean; cookies?: boolean; localStorage?: boolean; appcache?: boolean; userData?: boolean; filesystem?: boolean; shadercache?: boolean; websql?: boolean; serviceworkers?: boolean; cachestorage?: boolean; } interface AppAssetInfo { src?: string; alias?: string; version?: string; target?: string; args?: string; mandatory?: boolean; } interface CookieInfo { name: string; domain: string; path: string; } interface CookieOption { name: string; } export interface WindowDetails { uuid?: string; mainWindow?: WindowInfo; childWindows?: WindowInfo[]; } interface WindowInfo { /** * name of the child window */ name?: string; /** * top-most coordinate of the child window */ top?: number; /** * right-most coordinate of the child window */ right?: number; /** * bottom-most coordinate of the child window */ bottom?: number; /** * left-most coordinate of the child window */ left?: number; } type CosaicCloudInfo = { installerURL: string; manifestURL: string; }; export type DeployInfo = CosaicCloudInfo & { uuid?: string; }; export interface ProjectConfig { name: string; deployInfo?: DeployInfo; } export interface SDServerInfo { enabled: boolean; applicationRoot?: string; projectConfig?: ProjectConfig; } interface HostSpecInfo { /** * "x86" for 32-bit or "x86_64" for 64-bit */ arch: string; /** * Same payload as Node's os.cpus() */ cpus: NodeCpuInfo[]; gpu: { /** * Graphics card name */ name: string; }; /** * Same payload as Node's os.totalmem() */ memory: number; /** * OS name and version/edition */ name: string; } interface NodeCpuInfo { model: string; /** * in MHz */ speed: number; times: { /** * The number of milliseconds the CPU has spent in user mode. */ user: number; /** * The number of milliseconds the CPU has spent in nice mode. */ nice: number; /** * The number of milliseconds the CPU has spent in sys mode. */ sys: number; /** * The number of milliseconds the CPU has spent in idle mode. */ idle: number; /** * The number of milliseconds the CPU has spent in irq mode. */ irq: number; }; } export type Metric = { /** * the percentage of total CPU usage */ cpuUsage: number; /** * Process name (e.g. Main Process, GPU, etc) */ name: string; type: "Browser" | "Tab" | "Utility" | "Zygote" | "Sandbox helper" | "GPU" | "Pepper Plugin" | "Pepper Plugin Broker" | "Unknown"; /** * the peak working set size in bytes */ peakWorkingSetSize: number; /** * the native process identifier */ processId: number; workingSetSize: number; webContents: { [webContentId: number]: { windowName: string; webContentsName: string; type: "window" | "view"; }; }; }; export type ProcessInfo = Metric; export interface ExternalProcessLaunchInfo { path?: string; /** * Additionally note that the executable found in the zip file specified in appAssets * will default to the one mentioned by appAssets.target * If the the path below refers to a specific path it will override this default */ alias?: string; /** * When using alias; if no arguments are passed then the arguments (if any) * are taken from the 'app.json' file, from the 'args' parameter * of the 'appAssets' Object with the relevant 'alias'. * If 'arguments' is passed as a parameter it takes precedence * over any 'args' set in the 'app.json'. */ arguments?: string; listener?(result: { /** * "Exited" */ topic?: string; /** * The mapped UUID which identifies the launched process */ uuid?: string; exitCode?: number; }): void; certificate?: CertificationInfo; } interface CertificationInfo { /** * A hex string with or without spaces */ serial?: string; /** * An internally tokenized and comma delimited string allowing partial or full checks of the subject fields */ subject?: string; /** * A hex string with or without spaces */ publickey?: string; /** * A hex string with or without spaces */ thumbprint?: string; /** * A boolean indicating that the certificate is trusted and not revoked */ trusted?: boolean; } interface ExternalProcessInfo { pid?: number; listener?(result: { /** * "Exited" */ topic?: string; /** * The mapped UUID which identifies the launched process */ uuid?: string; exitCode?: number; }): void; } /** * Window * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. * The new window appears in the same process as the parent window. */ export interface FEAWindow { /** * Name of window (parent window if this is a view) */ name: string; /** * Name assigned to this WebContents (same as name unless is a titlebar or browser view) */ webContentsName: string; /** * The Electron WebContents ID associated with this WebContents. Guaranteed to be unique. */ webContentsId: number; addBrowserView(data: any, cb: Function): any; setZoomFactor(zoomFactor: number, cb?: Function): void; getZoomFactor(cb: (zoomFactor: number) => void): void; /** * Registers an event listener on the specified event. */ addEventListener(type: FEAWindowEventType, listener: (event: WindowBaseEvent | WindowAuthRequestedEvent | WindowBoundsEvent | WindowExternalProcessStartedEvent | WindowExternalProcessExited | WindowGroupChangedEvent | WindowHiddenEvent | Window_NavigationRejectedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Performs the specified window transitions */ animate(transitions: AnimationTransition, options: AnimationOptions, callback?: (event: any) => void, errorCallback?: (reason: string) => void): void; /** * Provides credentials to authentication requests */ authenticate(userName: string, password: string, callback?: () => void, errorCallback?: (reason: string, error: ErrorInfo) => void): void; /** * Removes focus from the window. */ blur(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Brings the window to the front of the FEA window stack. */ bringToFront(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Closes the window. * @param Close will be prevented from closing when force is false and 'close-requested' has been subscribed to for application's main window. */ bringViewToFront(viewId: any, cb: Function): any; close(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Create a basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, * maximize, restore, etc. The new window appears in the same process as the parent window. */ createNew(options: WindowOptions, cb: StandardErrorCallback): void; /** * Prevents a user from changing a window's size/position when using the window's frame. * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. * 'disabled-frame-bounds-changed' is generated after a user move/size operation. * The events provide the bounds that would have been applied if the frame was enabled. * 'frame-disabled' is generated when an enabled frame becomes disabled. */ disableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Re-enables user changes to a window's size/position when using the window's frame. * 'disabled-frame-bounds-changing' is generated at the start of and during a user move/size operation. * 'disabled-frame-bounds-changed' is generated after a user move/size operation. * The events provide the bounds that would have been applied if the frame was enabled. * 'frame-enabled' is generated when a disabled frame has becomes enabled. */ enableFrame(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Flashes the window's frame and taskbar icon until the window is activated. */ flash(options?: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Gives focus to the window. */ focus(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Gives focus to the title bar window. */ focusTitleBarWindow(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Gets the current bounds (top, left, width, height) of the window. */ getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void; /** * Returns an instance of the current window. * @returns Current window */ getCurrent(): FEAWindow; /** * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. * Please note that calling window is included in the result array. */ getGroup(callback?: (group: FEAWindow[]) => void, errorCallback?: (reason: string) => void): void; /** * Gets the current settings of the window. */ getOptions(callback?: (options: WindowOptions) => void, errorCallback?: (reason: string) => void): void; /** * Gets a base64 encoded PNG snapshot of the window. */ getSnapshot(callback?: (base64Snapshot: string) => void, errorCallback?: (reason: string) => void): void; /** * Gets the current state ("minimized", "maximized", or "restored") of the window. */ getState(callback?: (state: "minimized" | "maximized" | "restored") => void, errorCallback?: (reason: string) => void): void; /** * Gets the current title of the window. */ getTaskbarTitle(): string; /** * Returns the zoom level of the window. */ getZoomLevel(callback?: (level: number) => void, errorCallback?: (reason: string) => void): void; /** * Hides the window. */ hide(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Determines if the window is currently showing. */ isShowing(callback?: (showing: boolean) => void, errorCallback?: (reason: string) => void): void; /** * Joins the same window group as the specified window. */ joinGroup(target: FEAWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Leaves the current window group so that the window can be move independently of those in the group. */ leaveGroup(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Maximizes the window. */ maximize(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Merges the instance's window group with the same window group as the specified window */ mergeGroups(target: FEAWindow, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Minimizes the window. */ minimize(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Moves the window by a specified amount. */ moveBy(deltaLeft: number, deltaTop: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Moves the window to a specified location. */ moveTo(left: number, top: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Removes a previously registered event listener from the specified event. */ removeEventListener(type: FEAWindowEventType, listener: (event: WindowBaseEvent | WindowAuthRequestedEvent | WindowBoundsEvent | WindowExternalProcessStartedEvent | WindowExternalProcessExited | WindowGroupChangedEvent | WindowHiddenEvent | Window_NavigationRejectedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; removeBrowserView(viewId: number, cb?: Function): any; /** * Removes the application's icon from the tray. * @deprecated */ removeTrayIcon(callback?: () => void, errorCallback?: (reason: string) => void): void; resetBrowserView(cb?: Function): any; /** * Resizes the window by a specified amount. */ resizeBy(deltaWidth: number, deltaHeight: number, anchor: FEAAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Resizes the window by a specified amount. */ resizeTo(width: number, height: number, anchor: FEAAnchor, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Restores the window to its normal state (i.e., unminimized, unmaximized). */ restore(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Will bring the window to the front of the entire stack and give it focus. */ setAsForeground(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Sets the window's size and position */ setBounds(left: number, top: number, width: number, height: number, callback?: () => void, errorCallback?: (reason: string) => void): void; setTaskbarIcon(data: any): void; setTaskbarIconOverlay({ iconURL }: { iconURL: string | null; }): void; /** * Sets the window's title * @param title {string} window title to be displayed */ setTaskbarTitle(title: string): void; /** * Adds a customizable icon in the system tray and notifies the application when clicked. * @deprecated use System.setTrayIcon */ setTrayIcon(iconUrl: string, listener: { [key: string]: Function; }, callback?: () => void, errorCallback?: (reason: string) => void): void; setViewBounds(viewId: any, bounds: any, cb: Function): any; /** * Sets the zoom level of the window. */ setZoomLevel(level: number, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden. * @param Show will be prevented from closing when force is false and 'show-requested' has been subscribed to for application's main window. */ show(force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Shows the window if it is hidden at the specified location. If the toggle parameter is set to true, the window will alternate between showing and hiding. */ showAt(left: number, top: number, force?: boolean, callback?: () => void, errorCallback?: (reason: string) => void): void; /** Starts moving the window programatically. Will begin following the user's mouse. */ startMovingWindow(event: MouseEvent): any; /** Stops moving the window. */ stopMovingWindow(): any; /** * Stops the taskbar icon from flashing. */ stopFlashing(callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Updates the window using the passed options */ updateOptions(options: WindowOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; /** * Returns a Window object that wraps an existing window. */ wrap(windowName: string): FEAWindow; } export interface MonitorInfoChangedEvent extends MonitorInfo { topic: "system"; type: "monitor-info-changed"; } export type MonitorTaskbar = { edge: "left" | "right" | "top" | "bottom"; top: number; left: number; right: number; bottom: number; width: number; height: number; }; export interface MonitorInfo { nonPrimaryMonitors: MonitorInfoDetail[]; primaryMonitor: MonitorInfoDetail; reason: string; taskbar: MonitorTaskbar; topic: "system"; type: "monitor-info-changed"; virtualScreen: MonitorCoordinates; } export type MonitorInfoTaskbarDetails = { edge: "bottom" | "top" | "left" | "right"; height: number; width: number; bottom: number; left: number; right: number; top: number; }; export type MonitorRectDetails = { dipRect: MonitorCoordinates; scaledRect: MonitorCoordinates; }; export type MonitorInfoDetail = { monitor: MonitorRectDetails; availableRect: MonitorCoordinates; deviceId: string; displayDeviceActive: boolean; monitorRect: MonitorCoordinates; rawMonitor?: MonitorInfoDetail; name: string; whichMonitor?: number | "primary"; position?: number; deviceScaleFactor: number; taskbar?: MonitorInfoTaskbarDetails; }; export type MonitorCoordinates = { bottom: number; left: number; right: number; top: number; width: number; height: number; }; export interface VirtualScreenCoordinates { left: number; top: number; x: number; y: number; } export interface SystemBaseEvent { topic: string; type: FEASystemEventType; uuid: string; } export interface ProtocolHandlerEvent { url: string; } export interface DownloadItem { id: string; displayInfo: { filename: string; url: string; state: string; receivedBytes?: number; totalBytes: number; }; } export interface UpdateDownloadEvent { downloadItem: DownloadItem; } export interface DesktopIconClickedEvent { mouse: { /** * the left virtual screen coordinate of the mouse */ left: number; /** * the top virtual screen coordinate of the mouse */ top: number; }; /** * the number of milliseconds that have elapsed since the system was started, */ tickCount: number; topic: "system"; type: "desktop-icon-clicked"; } export interface IdleStateChangedEvent { /** * How long in milliseconds since the user has been idle. */ elapsedTime: number; /** * true when the user is idle,false when the user has returned; */ isIdle: boolean; topic: "system"; type: "idle-state-changed"; } interface WindowBaseEvent { /** * the name of the window */ name: string; /** * always window */ topic: "window"; /** * window event type */ type: FEAWindowEventType; /** * the UUID of the application the window belongs to */ uuid: string; } interface WindowAuthRequestedEvent extends WindowBaseEvent { authInfo: { host: string; isProxy: boolean; port: number; realm: string; scheme: string; }; } interface WindowBoundsEvent extends WindowBaseEvent { /** * describes what kind of change occurred. * 0 means a change in position. * 1 means a change in size. * 2 means a change in position and size. */ changeType: number; /** * true when pending changes have been applied to the window. */ deferred: boolean; /** * the new height of the window. */ height: number; /** * the left-most coordinate of the window. */ left: number; /** * the top-most coordinate of the window. */ top: number; type: "bounds-changed" | "bounds-changing" | "disabled-frame-bounds-changed" | "disabled-frame-bounds-changing" | "bounds-change-end"; /** * the new width of the window. */ width: number; } interface WindowExternalProcessStartedEvent extends WindowBaseEvent { /** * the process handle uuid */ processUuid: string; type: "external-process-started"; } interface WindowExternalProcessExited extends WindowBaseEvent { /** * the process exit code */ exitCode: number; /** * the process handle uuid */ processUuid: string; type: "external-process-exited"; } interface WindowGroupChangedEvent extends WindowBaseEvent { /** * Which group array the window that the event listener was registered on is included in: * 'source' The window is included in sourceGroup. * 'target' The window is included in targetGroup. * 'nothing' The window is not included in sourceGroup nor targetGroup. */ memberOf: "source" | "target" | "nothing"; /** * The reason this event was triggered. * 'leave' A window has left the group due to a leave or merge with group. * 'join' A window has joined the group. * 'merge' Two groups have been merged together. * 'disband' There are no other windows in the group. */ reason: "leave" | "join" | "merge" | "disband"; /** * All the windows in the group the sourceWindow originated from. */ sourceGroup: WindowOfGroupInfo[]; /** * The UUID of the application the sourceWindow belongs to The source window is the window in which (merge/join/leave)group(s) was called. */ sourceWindowAppUuid: string; /** * the name of the source window.The source window is the window in which(merge / join / leave) group(s) was called. */ sourceWindowName: string; /** * All the windows in the group the targetWindow originated from */ targetGroup: WindowOfGroupInfo[]; /** * The UUID of the application the targetWindow belongs to. The target window is the window that was passed into (merge/join) group(s). */ targetWindowAppUuid: string; /** * The name of the targetWindow. The target window is the window that was passed into (merge/join) group(s). */ targetWindowName: string; type: "group-changed"; } interface WindowOfGroupInfo { /** * The UUID of the application this window entry belongs to. */ appUuid: string; /** * The name of this window entry. */ windowName: string; } interface WindowHiddenEvent extends WindowBaseEvent { /** * What action prompted the close. * The reasons are: "hide", "hide-on-close" */ reason: "hide" | "hide-on-close"; type: "hidden"; } interface Window_NavigationRejectedEvent { name: string; /** * source of navigation window name */ sourceName: string; topic: "navigation-rejected"; /** * Url that was not reached "http://blocked-content.url" */ url: string; /** * the UUID of the application the window belongs to. */ uuid: string; } interface AnimationTransition { opacity?: { /** * This value is clamped from 0.0 to 1.0 */ opacity?: number; /** * The total time in milliseconds this transition should take. */ duration?: number; /** * Treat 'opacity' as absolute or as a delta. Defaults to false. */ relative?: boolean; }; position?: { /** * Defaults to the window's current left position in virtual screen coordinates. */ left?: number; /** * Defaults to the window's current top position in virtual screen coordinates. */ top?: number; /** * The total time in milliseconds this transition should take. */ duration?: number; /** * Treat 'left' and 'top' as absolute or as deltas. Defaults to false. */ relative?: boolean; }; size?: { /** * Optional if height is present. Defaults to the window's current width. */ width?: number; /** * Optional if width is present. Defaults to the window's current height. */ height?: number; /** * The total time in milliseconds this transition should take. */ duration?: number; /** * Treat 'width' and 'height' as absolute or as deltas. Defaults to false. */ relative?: boolean; }; } interface AnimationOptions { /** * This option interrupts the current animation. When false it pushes this animation onto the end of the animation queue. */ interrupt?: boolean; /** * Transition effect. Defaults to 'ease-in-out'. */ tween?: FEATweenType; } interface WindowBounds { /** * the height of the window. */ height?: number; /** * left-most coordinate of the window. */ left?: number; /** * top-most coordinate of the window. */ top?: number; /** * the width of the window. */ width?: number; } export interface SessionChangedEvent { /** * the action that triggered this event: */ reason: "lock" | "unlock" | "remote-connect" | "remote-disconnect" | "unknown"; topic: "system"; type: "session-changed"; } type FEATweenType = "linear" | "ease-in" | "ease-out" | "ease-in-out" | "ease-in-quad" | "ease-out-quad" | "ease-in-out-quad" | "ease-in-cubic" | "ease-out-cubic" | "ease-in-out-cubic" | "ease-out-bounce" | "ease-in-back" | "ease-out-back" | "ease-in-out-back" | "ease-in-elastic" | "ease-out-elastic" | "ease-in-out-elastic"; type FEASystemEventType = "application-closed" | "application-crashed" | "application-created" | "application-started" | "apply-update-requested" | "desktop-icon-clicked" | "idle-state-changed" | "monitor-info-changed" | "new-window-created" | "session-changed" | "system-tray-click" | "system-tray-right-click" | "system-tray-mouse-enter" | "protocol-handler-triggered" | "log-fea" | "download-update"; type FEAWindowEventType = "auth-requested" | "blurred" | "bounds-changed" | "bounds-changing" | "bounds-change-end" | "close-requested" | "closed" | "disabled-frame-bounds-changed" | "disabled-frame-bounds-changing" | "embedded" | "external-process-exited" | "external-process-started" | "focused" | "frame-disabled" | "frame-enabled" | "group-changed" | "hidden" | "initialized" | "maximized" | "minimized" | "navigation-rejected" | "restored" | "show-requested" | "shown"; type FEAAnchor = "top-left" | "top-right" | "bottom-left" | "bottom-right"; export interface FEA { desktop: FEADesktop; isTitlebarWindow: () => boolean; isBrowserView: () => boolean; hasBrowserView: () => boolean; getViewId: () => number | null; getWebContentsId: () => number | null; } export declare enum ProgressState { NotStarted = "NotStarted", Started = "Started", Error = "Error", Finished = "Finished" } export type ProgressItem = { step: string; state: ProgressState; percentComplete: number; error: string; }; export type Progress = { steps: { [key: string]: ProgressItem; }; currentStep: string; }; export {}; //# sourceMappingURL=FEA.d.ts.map