Tutorial: Window.EventEmitter

Window.EventEmitter

When an instance of fin.Window is created, it inherits an EventEmitter with the below methods so that it is possible to listen to OpenFin events. The below methods are asynchronous as they must cross process boundaries and setup the listener in the browser process. When the EventEmitter receives an event from the browser process and emits on the renderer, all of the functions attached to that specific event are called synchronously. Any values returned by the called listeners are ignored and will be discarded. If the execution context of the window is destroyed by page navigation or reload, any events that have been setup in that context will be destroyed. It is important to keep in mind that when an ordinary listener function is called, the standard this keyword is intentionally set to reference the EventEmitter instance to which the listener is attached. It is possible to use ES6 Arrow Functions as listeners, however, when doing so, the this keyword will no longer reference the EventEmitter instance.

addListener(event, listener)

Adds a listener to the end of the listeners array for the specified event.

const finWindow = await fin.Window.getCurrent();

finWindow.addListener("bounds-changed", function(event) {
    console.log("The window has been moved or resized.");
});

on(event, listener)

Adds a listener to the end of the listeners array for the specified event.

const finWindow = await fin.Window.getCurrent();

finWindow.on("bounds-changed", function(event) {
    console.log("The window has been moved or resized.");
});

once(event, listener)

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.

const finWindow = await fin.Window.getCurrent();

finWindow.once("bounds-changed", function(event) {
    console.log("The window has been moved or resized.");
});

prependListener(event, listener)

Adds a listener to the beginning of the listeners array for the specified event.

const finWindow = await fin.Window.getCurrent();

finWindow.prependListener("bounds-changed", function(event) {
    console.log("The window has been moved or resized.");
});

prependOnceListener(event, listener)

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.

const finWindow = await fin.Window.getCurrent();

finWindow.prependOnceListener("bounds-changed", function(event) {
    console.log("The window has been moved or resized.");
});

removeListener(event, listener)

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.

const finWindow = await fin.Window.getCurrent();
const callback = function(event) {
  console.log("The window has been moved or resized.");
};

finWindow.on("bounds-changed", callback);
finWindow.removeListener("bounds-changed", callback);

removeAllListeners([event])

Removes all listeners, or those of the specified event.

const finWindow = await fin.Window.getCurrent();
finWindow.removeAllListeners("bounds-changed");

Supported window event types

  • auth-requested
  • begin-user-bounds-changing
  • blurred
  • bounds-changed
  • bounds-changing
  • certificate-error
  • certificate-selection-shown
  • close-requested
  • closed
  • closing
  • context-changed
  • crashed
  • did-change-theme-color
  • disabled-movement-bounds-changed
  • disabled-movement-bounds-changing
  • embedded
  • end-user-bounds-changing
  • external-process-exited
  • external-process-started
  • file-download-completed
  • file-download-progress
  • file-download-started
  • found-in-page
  • focused
  • hidden
  • hotkey
  • initialized
  • maximized
  • minimized
  • options-changed
  • layout-initialized
  • layout-ready
  • navigation-rejected
  • page-favicon-updated
  • page-title-updated
  • performance-report
  • preload-scripts-state-changed
  • preload-scripts-state-changing
  • reloaded
  • resource-load-failed
  • resource-response-received
  • restored
  • show-requested
  • shown
  • user-movement-disabled
  • user-movement-enabled
  • view-attached
  • view-crashed (see View.EventEmitter)
  • view-created (see View.EventEmitter)
  • view-destroyed (see View.EventEmitter)
  • view-detached
  • view-did-change-theme-color (see View.EventEmitter)
  • view-hidden (see View.EventEmitter)
  • view-page-favicon-updated (see View.EventEmitter)
  • view-page-title-updated (see View.EventEmitter)
  • view-resource-load-failed (see View.EventEmitter)
  • view-resource-response-received (see View.EventEmitter)
  • view-shown (see View.EventEmitter)
  • view-will-redirect (see View.EventEmitter)
  • will-move
  • will-redirect
  • will-resize

Window Events

auth-requested

Generated when a window within this application requires credentials from the user. If there is a proxy, please see Proxy.behaviorChange for more details.

{
    name: "windowName",
    topic: "window",
    type: "auth-requested",
    uuid: "AppUUID" // the UUID of the application,
    authInfo: {
        host: "myserver",
        isProxy: false,
        port: 80,
        realm: "",
        scheme: "basic"
    }

}

begin-user-bounds-changing

Generated at the beginning of a user-driven change to a window's size or position.

{

    height: 2,              //the height of the window prior to change.
    left: 2,                //the left-most coordinate of the window prior to change.
    name: "windowName",     //(string) the name of the window.
    reason: "self"          //the reason for the bounds change: 'animation' | 'self' 
    top: 2,                 //the top-most coordinate of the window prior to change.
    topic: "window",
    type: "begin-user-bounds-changing",
    uuid: "appUUID",        //the UUID of the application the window belongs to.
    width: 2,               //the width of the window prior to change.
    windowState: "normal"   //the state of the window: "minimized", "normal", or "maximized"
}

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 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.
    deferred: 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.
    deferred: 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.
}

certificate-error

Generated when navigating to a URL that fails certificate validation.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "certificate-error",
    uuid: "AppUUID", //(string) the UUID of the application the window belongs to.
    error: "net::ERR_CERT_DATE_INVALID", //error detail
    url: "https://expired.badssl.com/", //url with the invalid certificate
    certificate: {}, //certificate object
}

certificate-selection-shown

Generated when the certificate selection dialog is shown.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "certificate-selection-shown",
    uuid: "AppUUID", //(string) the UUID of the application the window belongs to.
    url: "https://expired.badssl.com/", //url requesting certificate
    certificates: [], //certificate list
}

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.
}

closed

Generated when a window has closed.

//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.
}

closing

Generated when a window has initiated the closing routine.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "closing",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

context-changed

Generated when a window's context is updated via Platform.setWindowContext. Only available on windows in a Platform.


//This response has the following shape:
{
    topic: "window",
    type: "context-changed",
    uuid: "AppUUID",
    name: "windowName",
    context: {
        // context can be any shape.
    }
}

crashed

Generated when a window has crashed.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    reason: "killed", //possible values:
                      //  "normal-termination"    zero exit status
                      //  "abnormal-termination"  non-zero exit status
                      //  "killed"                e.g. SIGKILL or task manager kill
                      //  "crashed"               e.g. Segmentation fault
                      //  "still-running"         child hasn't exited yet
                      //  "launch-failed"         child process never launched
                      //  "out-of-memory"         process died due to oom
    topic: "window",
    type: "crashed",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

did-change-theme-color

Emitted when a page's theme color changes. This is usually due to encountering a meta tag:

{
    color: "#FF0000",
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "did-change-theme-color",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

disabled-movement-bounds-changed

Generated after a change to a window's size and/or position is attempted while window movement is disabled.

//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.
    deferred: 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-movement-bounds-changed",
    uuid: "appUUID",//the UUID of the application the window belongs to.
    width: 2        //the new width of the window.
}

disabled-movement-bounds-changing

Generated while a change to a window's size and/or position is attempted while window movement is disabled.

//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.
    deferred: 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-movement-bounds-changing",
    uuid: "appUUID",//the UUID of the application the window belongs to.
    width: 2        //the new width of the window.
}

embedded

Generated when a window has been embedded.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "window-embedded",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

end-user-bounds-changing

Generated at the end of a user-driven change to a window's size or position.

{

    height: 2,      //the height of the window prior to change.
    left: 2,        //the left-most coordinate of the window prior to change.
    name: "windowName", //(string) the name of the window.
    top: 2,         //the top-most coordinate of the window prior to change.
    topic: "window",
    type: "end-user-bounds-changing",
    uuid: "appUUID",//the UUID of the application the window belongs to.
    width: 2,       //the width of the window prior to change.
    windowState: "normal" // the state of the window: "minimized", "normal", or "maximized"
}

external-process-exited

Generated when an external process has exited.

//This response has the following shape:
{
    exitCode: 0, // the process exit code
    name: "windowOne", //the name of the window.
    processUuid: "3BAA4DA8-DBD6-4592-8C21-6427385911D2", // the process handle uuid
    topic: "window",
    type: "external-process-exited",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

external-process-started

Generated when an external process has started.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    processUuid: "3BAA4DA8-DBD6-4592-8C21-6427385911D2", // the process handle uuid
    topic: "window",
    type: "external-process-started",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

file-download-completed

Generated when a file download has completed.

//This response has the following shape:
{
    type: "file-download-completed",
    state: "started" | "completed" | "cancelled" |  "interrupted" | "paused"
    url: "https://download-location/file.pdf", //the url where the file is being downloaded from.
    mimeType: "application/pdf", //the file mime type.
    fileName: "file(1).pdf", //the name of the file as chosen by the user.
    originalFileName: "file.pdf", //the original name of the file.
    totalBytes: 347110, //the total size in bytes of the file.
    startTime: 1537994725.335115, //the number of seconds since the UNIX epoch when the download was started.
    contentDisposition: "", //the Content-Disposition field from the response header.
    lastModifiedTime: "Fri, 24 Aug 2018 03:12:32 GMT", //the Last-Modified header value.
    eTag: `W"54be6-16569eb4bad"`, //the ETag header value.
    downloadedBytes: 347110, //the downloaded bytes of the download item.
    topic: 'window',
    uuid: "AppUUID", //(string) the UUID of the application the window belongs to.
    name: "windowOne" //the name of the window.
}

file-download-progress

Generated during file download progress.

//This response has the following shape:
{
    type: "file-download-progress",
    state: "started" | "completed" | "cancelled" |  "interrupted" | "paused"
    url: "https://download-location/file.pdf", //the url where the file is being downloaded from.
    mimeType: "application/pdf", //the file mime type.
    fileName: null, //the name of the file as chosen by the user, can be null for progress events.
    originalFileName: "file.pdf", //the original name of the file.
    totalBytes: 347110, //the total size in bytes of the file.
    startTime: 1537994725.335115, //the number of seconds since the UNIX epoch when the download was started.
    contentDisposition: "", //the Content-Disposition field from the response header.
    lastModifiedTime: "Fri, 24 Aug 2018 03:12:32 GMT", //the Last-Modified header value.
    eTag: `W"54be6-16569eb4bad"`, //the ETag header value.
    downloadedBytes: 23820, //the downloaded bytes of the download item.
    topic: 'window',
    uuid: "AppUUID", //(string) the UUID of the application the window belongs to.
    name: "windowOne" //the name of the window.
}

file-download-started

Generated when a file download has started.

//This response has the following shape:
{
    type: "file-download-started",
    state: "started" | "completed" | "cancelled" |  "interrupted" | "paused"
    url: "https://download-location/file.pdf", //the url where the file is being downloaded from.
    mimeType: "application/pdf", //the file mime type.
    fileName: null, //the name of the file as chosen by the user, will be null for started events
    originalFileName: "file.pdf", //the original name of the file.
    totalBytes: 347110, //the total size in bytes of the file.
    startTime: 1537994725.335115, //the number of seconds since the UNIX epoch when the download was started.
    contentDisposition: "", //the Content-Disposition field from the response header.
    lastModifiedTime: "Fri, 24 Aug 2018 03:12:32 GMT", //the Last-Modified header value.
    eTag: `W"54be6-16569eb4bad"`, //the ETag header value.
    downloadedBytes: 23820, //the downloaded bytes of the download item.
    topic: 'window',
    uuid: "AppUUID", //(string) the UUID of the application the window belongs to.
    name: "windowOne" //the name of the window.
}

found-in-page

Generated when a result is available when calling Window.findInPage

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    result: {
        requestId: 1, // request id returned by the findInPage call.
        activeMatchOrdinal: 2, // Position of the active match.
        matches: 5, // Number of Matches.
        selectionArea: {
            height: 17,
            width: 10,
            x: 124,
            y: 173
        }, // Rectangle - Coordinates of first match region.
        finalUpdate: true
    }, // Event details,
    topic: 'window',
    type: "found-in-page",
    uuid: "AppUUID", //(string) the UUID of the application the window belongs to.
}

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.
}

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:
                    //"closing" if the event is triggered by close of the window
                    //"hide"
                    //"hide-on-close"
    topic: "window",
    type: "hidden",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

hotkey

Generated when a keyboard shortcut defined in the hotkeys array in Window options is pressed inside the window. For reference on keyboard event properties see KeyboardEvent.

//This response has the following shape:
{
    name: "WindowName", // the name of the window
    topic: "window",
    type: "hotkey",
    uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52", // (string) the UUID of the Application the Window belongs to.
    altKey: false,
    code: "KeyT",
    ctrlKey: true,
    inputType: "keyUp", // "keyUp" or "keyDown"
    key: "t",
    metaKey: false,
    repeat: false,
    shiftKey: false
}

initialized

Generated when a window is initialized.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "initialized",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

layout-initialized

Emitted when the window and all of its layout's views have either finished or failed navigation.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "layout-initialized",
    uuid: "AppUUID", //(string) the UUID of the application the window belongs to.
    views: [{"success": true, "identity": {"name": "view1", "uuid": "appUUID"}},
            {"success": false, "identity": {"name": "view2", "uuid": "appUUID"}, "error": Error)}] // a list of all views in the layout and their current initialization status
}

layout-ready

Emitted when the window and all of its layout's views have been created and can receive API calls.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "initialized",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
    views: [{"success": true, "identity": {"name": "view1", "uuid": "appUUID"}},
            {"success": false, "identity": {"name": "view2", "uuid": "appUUID"}, "error": Error)}] // a list of all views in the layout and their current initialization status
}

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.
}

minimized

Generated when a window is minimized.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "minimized",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

options-changed

Generated after window options are changed using the window.updateOptions method. Will not fire if the diff object is empty.

{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "options-changed",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
    diff: { // an object containing all changed options.
        "opacity": {   // a valid window option name
            oldVal: 0.5,
            newVal: 0.7
        },
        "minHeight": {
            oldVal: 300,
            newVal: 400
        }
    },
    options: { // The updated options object.
        opacity: 0.7,
        minHeight: 300,
        maxHeight: 600
        // ...
    },
    invalidOptions: ['someInvalidOptionName'] // A list of invalid option names in the call
}

navigation-rejected

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

{
    name: "windowOne", //the name of the window.
    sourceName: "source of navigation window name", // DEPRECATED
    topic: "window",
    type: "navigation-rejected",
    url: "http://blocked-content.url",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

page-favicon-updated

Emitted when page receives favicon urls.

{
    favicons: [
        "http://www.openfin.co/favicon.ico"
    ],
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "page-favicon-updated",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

page-title-updated

Fired when page title is set during navigation. explicitSet is false when title is synthesized from file url.

{
    explicitSet: true, // false when title is synthesized from file url.
    name: "windowOne", //the name of the window.
    title: "testTitle",
    topic: "window",
    type: "page-title-updated",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

preload-scripts-state-changed

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

//This response has the following shape:
{
    name: "windowOne",              // the name of the window
    topic: "window",
    type: "preload-scripts-state-changed",
    uuid: "AppUUID",                // the UUID of the application the window belongs to
    preloadScripts: [{              // an array of all final preload scripts' states
        ...,                        // original preload script's properties
        state: 'load-failed'|       // preload script failed to load
               'failed'|            // preload script failed to eval
               'succeeded'          // preload script eval'ed successfully
    }, ...]
}

preload-scripts-state-changing

Generated 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.

//This response has the following shape:
{
    name: "windowOne",              // the name of the window
    topic: "window",
    type: "preload-scripts-state-changing",
    uuid: "AppUUID",                // the UUID of the application the window belongs to
    preloadScripts: [{              // an array of a single preload script's state change
        ...,                        // original preload script's properties
        state: 'load-started'|      // started loading preload script
               'load-failed'|       // preload script failed to load
               'load-succeeded'|    // preload script is loaded and ready to be eval'ed
               'failed'|            // preload script failed to eval
               'succeeded'          // preload script eval'ed successfully
    }]
}

reloaded

Generated when a window has been reloaded

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "reloaded",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
    url: "http://localhost:8080/index.html" //the url has has been reloaded.
}

resource-load-failed

Generated when an HTTP load was cancelled or failed.

{
    name: "windowName",
    topic: "window",
    type: "resource-response-received",
    uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52", //the UUID of the application
    errorCode: -102,                              //the Chromium error code
    errorDescription: "",
    validatedURL: "http://bad-domain/dead-link.html",
    isMainFrame: true
}

resource-response-received

Generated when an HTTP resource request has received response details.

{
    name: "windowName",
    topic: "window",
    type: "resource-response-received",
    uuid: "454C7F31-A915-4EA2-83F2-CFA655453C52", //the UUID of the application
    status: false,
    newUrl: "https://www.google.com/?gws_rd=ssl", //the URL of the responded resource
    originalUrl: "http://www.google.com/",        //the requested URL
    httpResponseCode: 200,
    requestMethod: "GET",
    referrer: "",                                 //the URL of the referrer
    headers: {                                    //HTTP response headers
        "cache-control": [
            "private, max-age=0"
        ],
        "content-type": [
            "text/html; charset=UTF-8"
        ]
    },
    resourceType: "mainFrame"                     //"mainFrame", "subFrame",
                                                  //"styleSheet", "script", "image",
                                                  //"object", "xhr", or "other"
}

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.
}

show-requested

Generated 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.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "show-requested",
    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.
}

user-movement-disabled

Generated when a window's user movement becomes disabled.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "user-movement-disabled",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

user-movement-enabled

Generated when a window's user movement becomes enabled.

//This response has the following shape:
{
    name: "windowOne", //the name of the window.
    topic: "window",
    type: "user-movement-enabled",
    uuid: "AppUUID" //(string) the UUID of the application the window belongs to.
}

view-attached

Generated when a window has a view attached to it.

//This response has the following shape:
{
    name: "windowOne" // the name of this Window
    previousTarget: {uuid: 'previousWindowUuid', name: 'previousWindowName'}, // the identity of the window this View is being detached from
    target: {uuid: 'windowUuid', name: 'windowOne'}, // the identity of the window this View is attaching to
    topic: "window",
    type: "view-attached",
    uuid: "AppUUID" // the UUID of the application this window belongs to.
    viewIdentity: {uuid: 'viewUuid', name: 'viewName'}, // the identity of the View
}

view-detached

Generated when a window has a view detached from it. Will fire when a view is destroyed in which case target will be null.

//This response has the following shape:
{
    name: "windowOne" // the name of this Window
    previousTarget: {uuid: 'previousWindowUuid', name: 'previousWindowName'}, // the identity of the window this View is being detached from
    target: {uuid: 'windowUuid', name: 'windowOne'}, // the identity of the window this View is attaching to
    topic: "window",
    type: "view-attached",
    uuid: "AppUUID" // the UUID of the application this window belongs to.
    viewIdentity: {uuid: 'viewUuid', name: 'viewName'}, // the identity of the View
}

will-move

Generated when a window is being moved by the user. For use with monitor scaling that is not 100%. Bounds are given in DIP (adjusted for monitor scale factor).

//This response has the following shape:
{
    height: 300,      //the new height of the window.
    left: 300,        //the left-most coordinate of the window.
    monitorScaleFactor: 1.5 //the scaling factor of the monitor
    name: "windowName", //(string) the name of the window.
    top: 300,         //the top-most coordinate of the window.
    topic: "window",
    type: "will-move",
    uuid: "appUUID",  //the UUID of the application the window belongs to.
    width: 300        //the new width of the window.
}

will-redirect

Generated when window is being redirected as per contentRedirect whitelist/blacklist rules.

{
    blocked: true,
    isInPlace: false,
    name: "windowOne", // the name of the window.
    topic: "window",
    type: "will-redirect",
    url: "http://blocked-content.url",
    uuid: "AppUUID" // (string) the UUID of the application the window belongs to.
}

will-resize

Generated when a window is being resized by the user. For use with monitor scaling that is not 100%. Bounds are given in DIP (adjusted for monitor scale factor). The event will fire when a user resize is blocked by window options such as maxWidth or minHeight but not if the window is not resizable.

//This response has the following shape:
{
    height: 300,      //the new height of the window.
    left: 300,        //the left-most coordinate of the window.
    monitorScaleFactor: 1.5 //the scaling factor of the monitor
    name: "windowName", //(string) the name of the window.
    top: 300,         //the top-most coordinate of the window.
    topic: "window",
    type: "will-resize",
    uuid: "appUUID",  //the UUID of the application the window belongs to.
    width: 300        //the new width of the window.
}

performance-report

Generated when window finishes loading. Provides performance and navigation data.

//This response has the following shape:
{
    topic: "window",
    type: "performance-report",
    uuid: "appUUID", //(string) the UUID of the application the window belongs to.
    name: "windowName",
    navigation: {
        redirectCount: 0,
        type: 0
    },
    timeOrigin: 1561991787065.651,
    timing: {
        connectEnd: 0,
        connectStart: 0,
        domComplete: 1561991787504,
        domContentLoadedEventEnd: 1561991787503,
        domContentLoadedEventStart: 1561991787503,
        domInteractive: 1561991787503,
        domLoading: 1561991787283,
        domainLookupEnd: 0,
        domainLookupStart: 0,
        fetchStart: 0,
        loadEventEnd: 0,
        loadEventStart: 1561991787504,
        navigationStart: 1561991787065,
        redirectEnd: 0,
        redirectStart: 0,
        requestStart: 0,
        responseEnd: 1561991787282,
        responseStart: 0,
        secureConnectionStart: 0,
        unloadEventEnd: 0,
        unloadEventStart: 0
    }
}