Panel

Extend this class to show a custom panel to the user, whose contents are displayed in a sandboxed
iframe controlled by your extension.

To pass a message to a script running in the panel, call sendMessage. The data you pass in will be
sent to the iframe with window.postMessage.

To pass messages back from the panel to this class, call parent.postMessage from within the iframe.
The data sent will be passed along to the messageFromFrame implementation on your Panel class.

Extends


Constructors

new Panel()

new Panel(client, config): Panel

Parameters

ParameterType
clientEditorClient
configPanelConfig

Returns

Panel

Overrides

IframeUI.constructor


Properties

client

protected readonly client: EditorClient;

Inherited from

IframeUI.client


config

protected readonly config: PanelConfig;

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;

Inherited from

IframeUI.framePosition


loaded

protected loaded: boolean = false;

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

Inherited from

IframeUI.loaded


messageActionName

protected messageActionName: string;

Inherited from

IframeUI.messageActionName


Methods

frameClosed()

protected frameClosed(): void

Called when the iframe has been removed from the DOM

Returns

void

Inherited from

IframeUI.frameClosed


frameLoaded()

protected frameLoaded(): void

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

Returns

void

Inherited from

IframeUI.frameLoaded


hide()

hide(): void

Hide this panel if the panel is in the rightDock and it is currently visible.

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

Inherited from

IframeUI.hookMessages


messageFromFrame()

protected messageFromFrame(message): void

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

Parameters

ParameterTypeDescription
messageanydata sent from the iframe

Returns

void

Inherited from

IframeUI.messageFromFrame


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>

Inherited from

IframeUI.sendMessage


show()

show(): void

Show this panel if the panel is in the rightDock and it is not already visible.

Returns

void


unhookMessages()

protected unhookMessages(): void

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

Returns

void

Inherited from

IframeUI.unhookMessages