Methods
(static) create(options) → {Promise.<_Window>}
Creates a new Window.
Parameters:
Name | Type | Description |
---|---|---|
options |
Window~options | 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
addListener(eventType, listener, optionsopt) → {Promise.<this>}
Adds a listener to the end of the listeners array for the specified event.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventType |
string | symbol | The type of the event. |
|
listener |
function | Called whenever an event of the specified type occurs. |
|
options |
SubOptions |
<optional> |
Option to support event timestamps. |
- Tutorials:
Returns:
- Type
- Promise.<this>
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 challenge |
password |
string | password to provide to the authentication challenge |
- 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>
center() → {Promise.<void>}
Centers the window on its current screen.
- 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:
Returns:
- Type
- Promise.<void>
enableUserMovement() → {Promise.<void>}
Re-enables user changes to a window's size/position when using the window's frame.
- Tutorials:
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>
findInPage(searchTerm, options) → {Promise.<number>}
Find and highlight text on a page.
Parameters:
Name | Type | Description |
---|---|---|
searchTerm |
string | Term to find in page |
options |
FindInPageOptions | Search options |
- Tutorials:
Returns:
- Type
- Promise.<number>
flash() → {Promise.<void>}
Flashes the window’s frame and taskbar icon until stopFlashing is called or until a focus event is fired.
- 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, bottom, right, left, width, height) of the window.
- Tutorials:
Returns:
- Type
- Promise.<Bounds>
(async) getCurrentViews() → {Promise.Array.<View>}
Retrieves window's attached views.
- Tutorials:
-
- Tutorial: Window.getCurrentViews
Returns:
- Type
- Promise.Array.<View>
getGroup() → {Promise.<Array.<(_Window|ExternalWindow)>>}
Retrieves an array containing wrapped fin.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|ExternalWindow)>>
getInfo() → {Promise.<WindowInfo>}
Gets an information object for the window.
- Tutorials:
Returns:
- Type
- Promise.<WindowInfo>
getNativeId() → {Promise.<string>}
Returns the native OS level Id. In Windows, it will return the Windows handle.
- 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>
getPrinters() → {Promise.Array.<PrinterInfo>}
Returns an array with all system printers
- Tutorials:
Returns:
- Type
- Promise.Array.<PrinterInfo>
(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>
getWebWindow() → {object}
Gets the Window Object previously getNativeWindow
- Tutorials:
Returns:
- Type
- object
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>
isMainWindow() → {boolean}
Determines if the window is a main window.
- Tutorials:
Returns:
- Type
- boolean
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. Joining a group with native windows is currently not supported(method will nack).
Parameters:
Name | Type | Description |
---|---|---|
target |
_Window | ExternalWindow | 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 |
_Window | ExternalWindow | 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, options) → {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 |
options |
WindowMovementOptions | Optional parameters to modify window movement |
- Tutorials:
Returns:
- Type
- Promise.<void>
moveTo(left, top, options) → {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 |
options |
WindowMovementOptions | Optional parameters to modify window movement |
- Tutorials:
Returns:
- Type
- Promise.<void>
navigate(url) → {Promise.<void>}
Navigates the window to a specified URL. The url must contain the protocol prefix such as http:// or https://.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to navigate the window to. |
- Tutorials:
Returns:
- Type
- Promise.<void>
navigateBack() → {Promise.<void>}
Navigates the window back one page.
- Tutorials:
Returns:
- Type
- Promise.<void>
navigateForward() → {Promise.<void>}
Navigates the window forward one page.
- Tutorials:
Returns:
- Type
- Promise.<void>
on(eventType, listener, optionsopt) → {Promise.<this>}
Adds a listener to the end of the listeners array for the specified event.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventType |
string | symbol | The type of the event. |
|
listener |
function | Called whenever an event of the specified type occurs. |
|
options |
SubOptions |
<optional> |
Option to support event timestamps. |
- Tutorials:
Returns:
- Type
- Promise.<this>
once(eventType, listener, optionsopt) → {Promise.<this>}
Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventType |
string | symbol | The type of the event. |
|
listener |
function | The callback function. |
|
options |
SubOptions |
<optional> |
Option to support event timestamps. |
- Tutorials:
Returns:
- Type
- Promise.<this>
prependListener(eventType, listener, optionsopt) → {Promise.<this>}
Adds a listener to the beginning of the listeners array for the specified event.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventType |
string | symbol | The type of the event. |
|
listener |
function | The callback function. |
|
options |
SubOptions |
<optional> |
Option to support event timestamps. |
- Tutorials:
Returns:
- Type
- Promise.<this>
prependOnceListener(eventType, listener, optionsopt) → {Promise.<this>}
Adds a one time listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. The listener is added to the beginning of the listeners array.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventType |
string | symbol | The type of the event. |
|
listener |
function | The callback function. |
|
options |
SubOptions |
<optional> |
Option to support event timestamps. |
- Tutorials:
Returns:
- Type
- Promise.<this>
print(optionsopt) → {Promise.<void>}
Prints the window's web page
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
PrintOptions |
<optional> |
Printer Options |
- Tutorials:
Returns:
- Type
- Promise.<void>
reload() → {Promise.<void>}
Reloads the window current page
- Tutorials:
Returns:
- Type
- Promise.<void>
removeAllListeners(eventTypeopt) → {Promise.<this>}
Removes all listeners, or those of the specified event.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventType |
string | symbol |
<optional> |
The type of the event. |
- Tutorials:
Returns:
- Type
- Promise.<this>
removeListener(eventType, listener, optionsopt) → {Promise.<this>}
Remove a listener from the listener array for the specified event. Caution: Calling this method changes the array indices in the listener array behind the listener.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventType |
string | symbol | The type of the event. |
|
listener |
function | The callback function. |
|
options |
SubOptions |
<optional> |
Option to support event timestamps. |
- Tutorials:
Returns:
- Type
- Promise.<this>
resizeBy(deltaWidth, deltaHeight, anchor, options) → {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" |
options |
WindowMovementOptions | Optional parameters to modify window movement |
- Tutorials:
Returns:
- Type
- Promise.<void>
resizeTo(width, height, anchor, options) → {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" |
options |
WindowMovementOptions | Optional parameters to modify window movement |
- 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(options) → {Promise.<void>}
Sets the window's size and position.
Parameters:
Name | Type | Description |
---|---|---|
options |
WindowMovementOptions | Optional parameters to modify window movement |
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, options) → {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 |
options |
WindowMovementOptions | Optional parameters to modify window movement |
- Tutorials:
Returns:
- Type
- Promise.<void>
showDeveloperTools() → {Promise.<void>}
Shows the Chromium Developer Tools
- Tutorials:
Returns:
- Type
- Promise.<void>
stopFindInPage(action) → {Promise.<void>}
Stops any findInPage call with the provided action.
Parameters:
Name | Type | Description |
---|---|---|
action |
string | Action to execute when stopping a find in page: |
- 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. Values that are objects are deep-merged, overwriting only the values that are provided.
Parameters:
Name | Type | Description |
---|---|---|
options |
* | Changes a window's options that were defined upon creation. See tutorial |
- Tutorials:
Returns:
- Type
- Promise.<void>
Type Definitions
options
Window creation options.
This is the options object required by Window.create.
Note that name
is the only required property — albeit the url
property is usually provided as well
(defaults to "about:blank"
when omitted).
This jsdoc typedef mirrors the WindowOptions
TypeScript interface in @types/openfin
.
Type:
- object
Properties:
Name | Type | Attributes | Default | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
accelerator |
object |
<optional> |
Enable keyboard shortcuts for devtools, zoom, reload, and reload ignoring cache. Properties
|
||||||||||||||||||||||||||
alphaMask |
object |
<optional> |
Experimental. Updatable.
Properties
|
||||||||||||||||||||||||||
alwaysOnTop |
boolean |
<optional> |
false | Updatable. A flag to always position the window at the top of the window stack. |
|||||||||||||||||||||||||
api |
object |
<optional> |
Configurations for API injection. Properties
|
||||||||||||||||||||||||||
applicationIcon |
string |
<optional> |
"" | Deprecated - use |
|||||||||||||||||||||||||
aspectRatio |
number |
<optional> |
0 | Updatable. The aspect ratio of width to height to enforce for the window. If this value is equal to or less than zero, an aspect ratio will not be enforced. |
|||||||||||||||||||||||||
autoShow |
boolean |
<optional> |
true | A flag to automatically show the window when it is created. |
|||||||||||||||||||||||||
backgroundColor |
string |
<optional> |
"#FFF" | The window’s backfill color as a hexadecimal value. Not to be confused with the content background color
( |
|||||||||||||||||||||||||
contentNavigation |
object |
<optional> |
Restrict navigation to URLs that match a whitelisted pattern. In the lack of a whitelist, navigation to URLs that match a blacklisted pattern would be prohibited. See here for more details. Properties
|
||||||||||||||||||||||||||
contextMenu |
boolean |
<optional> |
true | Updatable. A flag to show the context menu when right-clicking on a window. Gives access to the devtools for the window. |
|||||||||||||||||||||||||
contextMenuSettings |
object |
<optional> |
Updatable. Configure the context menu when right-clicking on a window. Properties
|
||||||||||||||||||||||||||
cornerRounding |
object |
<optional> |
Updatable. Defines and applies rounded corners for a frameless window. NOTE: On macOS corner is not ellipse but circle rounded by the average of height and width. Properties
|
||||||||||||||||||||||||||
customData |
any |
<optional> |
"" | Updatable.
A field that the user can attach serializable data to to be ferried around with the window options.
When omitted, the default value of this property is the empty string ( |
|||||||||||||||||||||||||
customContext |
any |
<optional> |
"" | Updatable.
A field that the user can use to attach serializable data that will be saved when Platform.getSnapshot
is called. If a window in a Platform is trying to update or retrieve its own context, it can use the
Platform.setContext and Platform.getContext calls.
When omitted, the default value of this property is the empty string ( |
|||||||||||||||||||||||||
customRequestHeaders |
Array.<object> |
<optional> |
Defines list of custom headers for requests sent by the window. Properties
|
||||||||||||||||||||||||||
defaultCentered |
boolean |
<optional> |
false | Centers the window in the primary monitor. This option overrides |
|||||||||||||||||||||||||
defaultHeight |
number |
<optional> |
500 | The default height of the window. When |
|||||||||||||||||||||||||
defaultLeft |
number |
<optional> |
100 | The default left position of the window. When |
|||||||||||||||||||||||||
defaultTop |
number |
<optional> |
100 | The default top position of the window. When |
|||||||||||||||||||||||||
defaultWidth |
number |
<optional> |
800 | The default width of the window. When |
|||||||||||||||||||||||||
frame |
boolean |
<optional> |
true | Updatable. A flag to show the frame. |
|||||||||||||||||||||||||
icon |
string |
<optional> |
Updatable. Inheritable. A URL for the icon to be shown in the window title bar and the taskbar. When omitted, inherits from the parent application. |
||||||||||||||||||||||||||
maxHeight |
number |
<optional> |
-1 | Updatable. The maximum height of a window. Will default to the OS defined value if set to -1. |
|||||||||||||||||||||||||
maximizable |
boolean |
<optional> |
true | Updatable. A flag that lets the window be maximized. |
|||||||||||||||||||||||||
maxWidth |
number |
<optional> |
-1 | Updatable. The maximum width of a window. Will default to the OS defined value if set to -1. |
|||||||||||||||||||||||||
minHeight |
number |
<optional> |
0 | Updatable. The minimum height of a window. |
|||||||||||||||||||||||||
minimizable |
boolean |
<optional> |
true | Updatable. A flag that lets the window be minimized. |
|||||||||||||||||||||||||
minWidth |
number |
<optional> |
0 | Updatable. The minimum width of a window. |
|||||||||||||||||||||||||
name |
string | The name of the window. |
|||||||||||||||||||||||||||
opacity |
number |
<optional> |
1.0 | Updatable.
A flag that specifies how transparent the window will be.
This value is clamped between |
|||||||||||||||||||||||||
preloadScripts |
Array.<preloadScript> |
<optional> |
Inheritable A list of scripts that are eval'ed before other scripts in the page. When omitted, inherits from the parent application. |
||||||||||||||||||||||||||
resizable |
boolean |
<optional> |
true | Updatable. A flag to allow the user to resize the window. |
|||||||||||||||||||||||||
resizeRegion |
object |
<optional> |
Updatable. Defines a region in pixels that will respond to user mouse interaction for resizing a frameless window. Properties
|
||||||||||||||||||||||||||
saveWindowState |
boolean |
<optional> |
true | A flag to cache the location of the window. |
|||||||||||||||||||||||||
shadow |
boolean |
<optional> |
false | A flag to display a shadow on frameless windows.
|
|||||||||||||||||||||||||
showTaskbarIcon |
boolean |
<optional> |
true | Updatable. Windows. A flag to show the window's icon in the taskbar. |
|||||||||||||||||||||||||
smallWindow |
boolean |
<optional> |
false | A flag to specify a frameless window that can be be created and resized to less than 41x36px (width x height). Note: Caveats of small windows are no Aero Snap and drag to/from maximize. |
|||||||||||||||||||||||||
state |
string |
<optional> |
"normal" | The visible state of the window on creation. One of:
|
|||||||||||||||||||||||||
taskbarIcon |
string |
<optional> |
string | Deprecated - use |
|||||||||||||||||||||||||
taskbarIconGroup |
string |
<optional> |
<application uuid> | Windows.
Specify a taskbar group for the window.
If omitted, defaults to app's uuid ( |
|||||||||||||||||||||||||
url |
string |
<optional> |
"about:blank" | The URL of the window. |
|||||||||||||||||||||||||
uuid |
string |
<optional> |
<application uuid> | The |
|||||||||||||||||||||||||
waitForPageLoad |
boolean |
<optional> |
false | When set to |