Class: Window

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.

Constructor

new Window()

Methods

(static) create(options) → {Promise.<_Window>}

Creates a new Window.

Parameters:
Name Type Description
options WindowOption

Window creation options

Tutorials:
Returns:
Type
Promise.<_Window>

(static) getCurrent() → {Promise.<_Window>}

Asynchronously returns a Window object that represents the current window

Tutorials:
Returns:
Type
Promise.<_Window>

(static) getCurrentSync() → {_Window}

Synchronously returns a Window object that represents the current window

Tutorials:
Returns:
Type
_Window

(async, static) wrap(identity) → {Promise.<_Window>}

Asynchronously returns a Window object that represents an existing window.

Parameters:
Name Type Description
identity Identity
Tutorials:
Returns:
Type
Promise.<_Window>

(static) wrapSync(identity) → {_Window}

Synchronously returns a Window object that represents an existing window.

Parameters:
Name Type Description
identity Identity
Tutorials:
Returns:
Type
_Window

animate(transitions, options) → {Promise.<void>}

Performs the specified window transitions.

Parameters:
Name Type Description
transitions Transition

Describes the animations to perform. See the tutorial.

options TransitionOptions

Options for the animation. See the tutorial.

Tutorials:
Returns:
Type
Promise.<void>

authenticate(userName, password) → {Promise.<void>}

Provides credentials to authentication requests

Parameters:
Name Type Description
userName string

userName to provide to the authentication challange

password string

password to provide to the authentication challange

Tutorials:
Returns:
Type
Promise.<void>

blur() → {Promise.<void>}

Removes focus from the window.

Tutorials:
Returns:
Type
Promise.<void>

bringToFront() → {Promise.<void>}

Brings the window to the front of the window stack.

Tutorials:
Returns:
Type
Promise.<void>

close(forceopt) → {Promise.<void>}

closes the window application

Parameters:
Name Type Attributes Default Description
force boolean <optional>
false

Close will be prevented from closing when force is false and ‘close-requested’ has been subscribed to for application’s main window.

Tutorials:
Returns:
Type
Promise.<void>

disableUserMovement() → {Promise.<void>}

Prevents a user from changing a window's size/position when using the window's frame.

Tutorials:
  • Tutorial: Window.disableUserMovement
Returns:
Type
Promise.<void>

enableUserMovement() → {Promise.<void>}

Re-enables user changes to a window's size/position when using the window's frame.

Tutorials:
  • Tutorial: Window.enableUserMovement
Returns:
Type
Promise.<void>

executeJavaScript(code) → {Promise.<void>}

Executes Javascript on the window, restricted to windows you own or windows owned by applications you have created.

Parameters:
Name Type Description
code string

JavaScript code to be executed on the window.

Tutorials:
Returns:
Type
Promise.<void>

flash() → {Promise.<void>}

Flashes the window’s frame and taskbar icon until stopFlashing is called.

Tutorials:
Returns:
Type
Promise.<void>

focus() → {Promise.<void>}

Gives focus to the window.

Tutorials:
Fires:
  • _Window#event:focused
Returns:
Type
Promise.<void>

getAllFrames() → {Promise.<Array.<FrameInfo>>}

Retrieves an array of frame info objects representing the main frame and any iframes that are currently on the page.

Tutorials:
Returns:
Type
Promise.<Array.<FrameInfo>>

getBounds() → {Promise.<Bounds>}

Gets the current bounds (top, left, width, height) of the window.

Tutorials:
Returns:
Type
Promise.<Bounds>

getGroup() → {Promise.<Array.<_Window>>}

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.

Tutorials:
Returns:
Type
Promise.<Array.<_Window>>

getInfo() → {Promise.<WindowInfo>}

Gets an information object for the window.

Tutorials:
Returns:
Type
Promise.<WindowInfo>

getNativeId() → {Promise.<string>}

Returns then running applications uuid

Tutorials:
Returns:
Type
Promise.<string>

getOptions() → {Promise.<any>}

Gets the current settings of the window.

Tutorials:
Returns:
Type
Promise.<any>

getParentApplication() → {Promise.<Application>}

Gets the parent application.

Tutorials:
Returns:
Type
Promise.<Application>

getParentWindow() → {Promise.<_Window>}

Gets the parent window.

Tutorials:
Returns:
Type
Promise.<_Window>

(async) getSnapshot(areaopt) → {Promise.<string>}

Gets a base64 encoded PNG snapshot of the window or just part a of it.

Parameters:
Name Type Attributes Description
area Area <optional>

The area of the window to be captured. Omitting it will capture the whole visible window.

Tutorials:
Returns:
Type
Promise.<string>

getState() → {Promise.<string>}

Gets the current state ("minimized", "maximized", or "restored") of the window.

Tutorials:
Returns:
Type
Promise.<string>

getZoomLevel() → {Promise.<number>}

Returns the zoom level of the window.

Tutorials:
Returns:
Type
Promise.<number>

hide() → {Promise.<void>}

Hides the window.

Tutorials:
Returns:
Type
Promise.<void>

isShowing() → {Promise.<boolean>}

Determines if the window is currently showing.

Tutorials:
Returns:
Type
Promise.<boolean>

joinGroup(target) → {Promise.<void>}

Joins the same window group as the specified window.

Parameters:
Name Type Description
target class

The window whose group is to be joined

Tutorials:
Returns:
Type
Promise.<void>

leaveGroup() → {Promise.<void>}

Leaves the current window group so that the window can be move independently of those in the group.

Tutorials:
Returns:
Type
Promise.<void>

maximize() → {Promise.<void>}

Maximizes the window

Tutorials:
Returns:
Type
Promise.<void>

mergeGroups(target) → {Promise.<void>}

Merges the instance's window group with the same window group as the specified window

Parameters:
Name Type Description
target class

The window whose group is to be merged with

Tutorials:
Returns:
Type
Promise.<void>

minimize() → {Promise.<void>}

Minimizes the window.

Tutorials:
Returns:
Type
Promise.<void>

moveBy(deltaLeft, deltaTop) → {Promise.<void>}

Moves the window by a specified amount.

Parameters:
Name Type Description
deltaLeft number

The change in the left position of the window

deltaTop number

The change in the top position of the window

Tutorials:
Returns:
Type
Promise.<void>

moveTo(left, top) → {Promise.<void>}

Moves the window to a specified location.

Parameters:
Name Type Description
left number

The left position of the window

top number

The top position of the window

Tutorials:
Returns:
Type
Promise.<void>

Navigates the window to a specified URL.

Parameters:
Name Type Description
url string

The URL to navigate the window to.

Tutorials:
Returns:
Type
Promise.<void>

Navigates the window back one page.

Tutorials:
Returns:
Type
Promise.<void>

Navigates the window forward one page.

Tutorials:
  • Tutorial: window.navigateForward
Returns:
Type
Promise.<void>

reload() → {Promise.<void>}

Reloads the window current page

Tutorials:
Returns:
Type
Promise.<void>

resizeBy(deltaWidth, deltaHeight, anchor) → {Promise.<void>}

Resizes the window by a specified amount.

Parameters:
Name Type Description
deltaWidth number

The change in the width of the window

deltaHeight number

The change in the height of the window

anchor AnchorType

Specifies a corner to remain fixed during the resize. Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right". If undefined, the default is "top-left"

Tutorials:
Returns:
Type
Promise.<void>

resizeTo(width, height, anchor) → {Promise.<void>}

Resizes the window to the specified dimensions.

Parameters:
Name Type Description
width number

The change in the width of the window

height number

The change in the height of the window

anchor AnchorType

Specifies a corner to remain fixed during the resize. Can take the values: "top-left", "top-right", "bottom-left", or "bottom-right". If undefined, the default is "top-left"

Tutorials:
Returns:
Type
Promise.<void>

restore() → {Promise.<void>}

Restores the window to its normal state (i.e., unminimized, unmaximized).

Tutorials:
Returns:
Type
Promise.<void>

setAsForeground() → {Promise.<void>}

Will bring the window to the front of the entire stack and give it focus.

Tutorials:
Returns:
Type
Promise.<void>

setBounds() → {Promise.<void>}

Sets the window's size and position.

Properties:
Name Type Description
bounds Bounds

This is a * @type {string} name - name of the window.object that holds the propertys of

Tutorials:
Returns:
Type
Promise.<void>

setZoomLevel(level) → {Promise.<void>}

Sets the zoom level of the window.

Parameters:
Name Type Description
level number

The zoom level

Tutorials:
Returns:
Type
Promise.<void>

show(forceopt) → {Promise.<void>}

Shows the window if it is hidden.

Parameters:
Name Type Attributes Default Description
force boolean <optional>
false

Show will be prevented from showing when force is false and ‘show-requested’ has been subscribed to for application’s main window.

Tutorials:
Returns:
Type
Promise.<void>

showAt(left, top, force) → {Promise.<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.

Parameters:
Name Type Default Description
left number

The left position of the window

top number

The right position of the window

force boolean false

Show will be prevented from closing when force is false and ‘show-requested’ has been subscribed to for application’s main window

Tutorials:
Returns:
Type
Promise.<void>

showDeveloperTools() → {Promise.<void>}

Shows the Chromium Developer Tools

Tutorials:
Returns:
Type
Promise.<void>

stopFlashing() → {Promise.<void>}

Stops the taskbar icon from flashing.

Tutorials:
Returns:
Type
Promise.<void>

stopNavigation() → {Promise.<void>}

Stops any current navigation the window is performing.

Tutorials:
Returns:
Type
Promise.<void>

updateOptions(options) → {Promise.<void>}

Updates the window using the passed options

Parameters:
Name Type Description
options *

Changes a window's options that were defined upon creation. See tutorial

Tutorials:
Returns:
Type
Promise.<void>

Events

auth-requested

Raised when a window within this application requires credentials from the user.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

authInfo object
Properties
Name Type Description
host string

Host server.

isProxy boolean

Indicates if the request involves a proxy.

port number

Port number.

realm string

Authentication request realm.

scheme string

Authentication scheme.

blurred

Raised when a window loses focus.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

bounds-changed

Raised after changes in a window's size and/or position.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

changeType number

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.

deferred string

Indicated whether pending changes have been applied.

height number

New height of the window.

left number

New left most coordinate of the window.

top number

New top most coordinate of the window.

width number

New width of the window.

close-requested

Raised when a window has been prevented from closing. A window will be prevented from closing by default, either through the API or by a user when ‘close-requested’ has been subscribed to and the Window.close(force) flag is false.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

closed

Raised when a window has closed.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

crashed

Raised when a window has crashed.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

disabled-movement-bounds-changed

Raised when the user movement is disabled after all prevent user changes in window's size and/or position have completed.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

changeType number

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.

deferred string

Indicated whether pending changes have been applied.

height number

New height of the window.

left number

New left most coordinate of the window.

top number

New top most coordinate of the window.

width number

New width of the window.

disabled-movement-bounds-changing

Raised when the user movement is disabled during prevented user changes to a window's size and/or position.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

changeType number

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.

deferred string

Indicated whether pending changes have been applied.

height number

New height of the window.

left number

New left most coordinate of the window.

top number

New top most coordinate of the window.

width number

New width of the window.

embedded

Raised when the window has been embedded.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

external-process-exited

Raised when an external process has exited.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

processUuid string

The process handle UUID.

exitCode number

The process exit code

external-process-started

Raised when an external process has started.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

processUuid string

The process handle UUID.

group-changed

Raised when a window joins/leaves a group and/or when the group a window is a member of changes.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

source string

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.

reason string

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.

name string

Name of the window.

sourceGroup Array.<legacyWindowIdentity>

All the windows in the group the sourceWindow originated from.

sourceWindowAppUuid string

UUID of the application the sourceWindow belongs to the source window is the window in which (merge/join/leave)group(s) was called.

sourceWindowName string

Name of the sourcewindow. The source window is the window in which (merge/join/leave)group(s) was called.

targetGroup Array.<legacyWindowIdentity>

All the windows in the group the targetWindow orginated from.

targetWindowAppUuid string

UUID of the application the targetWindow belongs to. The target window is the window that was passed into (merge/join)group(s).

targetWindowName string

Name of the targetWindow. The target window is the window that was passed into (merge/join)group(s).

hidden

Raised when a window has been hidden.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

reason string

Action prompted the close The reasons are: "hide" "hide-on-close"

initialized

Raised when a window is initialized.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

maximized

Raised when a window is maximized.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

minimized

Raised when a window is minimized.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

navigation-rejected

Raised when window navigation is rejected as per ContentNavigation whitelist/blacklist rules.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

sourceName string

source of navigation window name.

url string

Blocked content url.

out-of-memory

Raised when a window is out of memory.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

preload-scripts-state-changed

Raised after the execution of all of a window's preload scripts. Contains information about all window's preload scripts' final states.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

preloadState Array.<preloadScriptState>

An array of all final preload scripts' states

preload-scripts-state-changing

Raised during the execution of a window's preload script. Contains information about a single window's preload script's state, for which the event has been raised.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

preloadState Array.<preloadScriptState>

An array of all final preload scripts' states

reloaded

Raised when a window has reloaded.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

url string

Url has has been reloaded.

resource-load-failed

Raised when an HTTP load was cancelled or failed.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

errorCode number

The Chromium error code.

errorDescription string

The Chromium error description.

validatedURL string

The url attempted.

isMainFrame boolean

Was the attempt made from the main frame.

resource-response-received

Raised when an HTTP resource request has received response details.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

status boolean

Status of the request.

newUrl string

The URL of the responded resource.

originalUrl string

The requested URL.

httpResponseCode number

The HTTP Response code.

requestMethod string

The HTTP request method.

referrer string

The HTTP referrer.

headers object

The HTTP headers.

resourceType string

Resource type: "mainFrame", "subFrame", "styleSheet", "script", "image", "object", "xhr", or "other"

restored

Raised when a window is displayed after having been minimized or when a window leaves the maximize state without minimizing.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

show-requested

Raised when a window has been prevented from showing. A window will be prevented from showing by default, either through the API or by a user when ‘show-requested’ has been subscribed to on the window or 'window-show-requested' on the parent application and the Window.show(force) flag is false.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

shown

Raised when a window been shown.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

user-movement-disabled

Raised when a window's user movement becomes disabled.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.

user-movement-enabled

Raised when a window's user movement becomes enabled.

Type:
  • object
Properties:
Name Type Description
name string

Name of the window.

uuid string

UUID of the application that the window belongs to.