IframeUI

Base class for defining and interacting with custom UI elements whose contents are displayed
in an iframe.

Extended by


Constructors

new IframeUI()

new IframeUI(client): IframeUI

Parameters

ParameterType
clientEditorClient

Returns

IframeUI


Properties

client

protected readonly client: EditorClient;

framePosition

protected framePosition: object;

The location of this frame within the top-level browser window. This is always updated immediately before
messageFromFrame is called.

h

h: number = 1;

w

w: number = 1;

x

x: number = 0;

y

y: number = 0;

loaded

protected loaded: boolean = false;

True after the iframe has fired an onload event (not all scripts are necessarily finished executing)


messageActionName

protected messageActionName: string;

Methods

frameClosed()

protected frameClosed(): void

Called when the iframe has been removed from the DOM

Returns

void


frameLoaded()

protected frameLoaded(): void

Called when the iframe has been constructed, its srcdoc set, and the window loaded event has fired

Returns

void


hookMessages()

protected hookMessages(): void

Subclasses must call hookMessages some time before the UI is displayed. A Modal
will call this when the open() method is called, where a Panel will need to do
this in the constructor to watch for the user opening the panel.

Returns

void


messageFromFrame()

protected messageFromFrame(message): void

Receives messages sent from the iframe via parent.postMessage(, '*')

Parameters

ParameterTypeDescription
messageanydata sent from the iframe

Returns

void


sendMessage()

sendMessage(data): Promise<void>

Send a message to this UI component's iframe via window.postMessage.

Parameters

ParameterTypeDescription
dataJsonSerializableData to send to the iframe

Returns

Promise<void>


unhookMessages()

protected unhookMessages(): void

Subclasses must call unhookMessages to allow them to be garbage collected.

Returns

void