Tutorial: frame.addEventListener

frame.addEventListener

Attaches a listener to the referenced frame. Supported event types are:

  • connected
  • disconnected

Example

const listener = (info) => console.log(info); // see return value below
const successCallback = () => console.log('listener added success');
const errorCallback = (errStr, err) => console.log(err);
const myFrame = fin.desktop.Frame.wrap('OpenfinPOC','2407fac7-25dc-4bba-9add-cd09b2fc078c');

myFrame.addEventListener('disconnected', listener, successCallback, errorCallback);

// example info shape
{
    "topic": "frame",
    "type": "disconnected",
    "uuid": "OpenfinPOC",
    "frameName": "2407fac7-25dc-4bba-9add-cd09b2fc078c",
    "entityType": "iframe"
}