Registers an event listener on the specified event. Supported window event types are:
- blurred
- bounds-changed
- bounds-changing
- closed
- close-requested
- disabled-frame-bounds-changed
- disabled-frame-bounds-changing
- focused
- frame-disabled
- frame-enabled
- group-changed
- hidden
- maximized
- minimized
- restored
- shown
Example
var finWindow = fin.desktop.Window.getCurrent();
finWindow.addEventListener("bounds-changed", function (event) {
console.log("The window has been moved or resized");
}, function () {
console.log("The registration was successful");
},function (reason) {
console.log("failure:" + reason);
});
Window Events
blurred
Generated when a window loses focus.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "blurred",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
bounds-changed
Generated after changes in window's size and/or position.
//This response has the following shape:
{
changeType: 2, //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.
deffered: true, //true when pending changes have been applied.
//to the window.
height: 2, //the new height of the window.
left: 2, //the left-most coordinate of the window.
name: "windowName", //(string) the name of the window.
top: 2, //the top-most coordinate of the window.
topic: "window",
type: "bounds-changed",
uuid: "appUUID",//the UUID of the application the window belongs to.
width: 2 //the new width of the window.
}
bounds-changing
Generated during changes to a window's size and/or position.
//This response has the following shape:
{
changeType: 2, //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.
deffered: true, //true when pending changes have been applied.
//to the window.
height: 2, //the new height of the window.
left: 2, //the left-most coordinate of the window.
name: "windowName", //(string) the name of the window.
top: 2, //the top-most coordinate of the window.
topic: "window",
type: "bounds-changing",
uuid: "appUUID",//the UUID of the application the window belongs to.
width: 2 //the new width of the window.
}
closed
Generated on changes to a user’s local computer session.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "closed",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
close-requested
Generated 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.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "close-requested",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
disabled-frame-bounds-changed
Generated when the frame is disabled after all prevent user changes in window's size and/or position have completed.
//This response has the following shape:
{
changeType: 2, //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.
deffered: true, //true when pending changes have been applied.
//to the window.
height: 2, //the new height of the window.
left: 2, //the left-most coordinate of the window.
name: "windowName", //(string) the name of the window.
top: 2, //the top-most coordinate of the window.
topic: "window",
type: "disabled-frame-bounds-changed",
uuid: "appUUID",//the UUID of the application the window belongs to.
width: 2 //the new width of the window.
}
disabled-frame-bounds-changing
Generated when the frame is disabled during prevented user changes to a window's size and/or position.
//This response has the following shape:
{
changeType: 2, //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.
deffered: true, //true when pending changes have been applied.
//to the window.
height: 2, //the new height of the window.
left: 2, //the left-most coordinate of the window.
name: "windowName", //(string) the name of the window.
top: 2, //the top-most coordinate of the window.
topic: "window",
type: "disabled-frame-bounds-changing",
uuid: "appUUID",//the UUID of the application the window belongs to.
width: 2 //the new width of the window.
}
focused
Generated when a window receives focus.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "focused",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
frame-disabled
Generated when a window's frame becomes disabled.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "frame-disabled",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
frame-enabled
Generated when a window joins/leaves a group and/or when the group a window is a member of changes.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "frame-enabled",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
group-changed
Generated when a window joins/leaves a group and/or when the group a window is a member of changes.
//This response has the following shape:
{
memberOf: "source", //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.
name: "windowName", //the name of the window.
reason: "merge", //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.
sourceGroup: [ //All the windows in the group the sourceWindow originated from.
{
appUuid: "appUUID", //The UUID of the application this window entry belongs to.
windowName: "windowName" //The name of this window entry.
}
],
sourceWindowAppUuid: "appUUID", //The UUID of the application the sourceWindow belongs to The source window is the window in which (merge/join/leave)group(s) was called.
sourceWindowName: "sourceWindowName", the name of the sourcewindow. The source window is the window in which (merge/join/leave)group(s) was called.
targetGroup: [ //All the windows in the group the targetWindow orginated from
{
appUuid: "appUUID", //The UUID of the application this window entry belongs to.
windowName: "windowName" //The name of this window entry.
}
],
targetWindowAppUuid: "targetWindowUUID", //The UUID of the application the targetWindow belongs to. The target window is the window that was passed into (merge/join)group(s).
targetWindowName: "targetWindowName", //The name of the targetWindow. The target window is the window that was passed into (merge/join)group(s).
topic: "window",
type: "group-changed",
uuid: "applicationUUID" //The UUID of the application the window belongs to.
}
hidden
Generated when a window has been hidden.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
reason: "hide", //What action prompted the close The reasons are:
//"hide"
//"hide-on-close"
topic: "window",
type: "hidden",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
maximized
Generated when a window is maximized.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "maximized",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
restored
Generated when a window is displayed after having been minimized or when a window leaves the maximize state without minimizing.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "restored",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}
shown
Generated when a hidden window has been shown.
//This response has the following shape:
{
name: "windowOne", //the name of the window.
topic: "window",
type: "shown",
uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}