initAppElement

API reference for the initAppElement method.
#appElementConfigAppElementClientConfiguration<A>
Required

Configuration for an AppElementClient

Properties of appElementConfig
#renderAppElementRenderer<A>
Required

Registers a callback that renders an app element based on the data it receives.

Parameters

#appElementDataA
Required

The data the callback must use to render the app element.

Returns

An array of one or more elements to render as output of an app element.

AppElementRendererOutput

A client that provides methods for creating and managing the lifecycle of an app element.

#addOrUpdateElementfunction

If an app element is selected, the element's data is overwritten and the element is re-rendered. Otherwise, the provided data is used to create a new app element.

Parameters

#appElementDataA
Required

The data to attach to the app element. Existing data will be overwritten.

#placementPlacement
Optional

The position, dimensions, and rotation of the app element.

Properties of placement
#leftnumber
Required

The distance from the left edge of the container, in pixels.

  • The pixels are relative to their container.
  • Minimum: -32768
  • Maximum: 32767
#topnumber
Required

The distance from the top edge of the container, in pixels.

  • The pixels are relative to their container.
  • Minimum: -32768
  • Maximum: 32767
#rotationnumber
Optional

A rotation, in degrees.

  • Minimum: -180
  • Maximum: 180
#heightnumber
Required

A height, in pixels.

  • The pixels are relative to their container.
  • Minimum: 0
  • Maximum: 32767
#widthnumber
Required

A width, in pixels.

  • The pixels are relative to their container.
  • Minimum: 0
  • Maximum: 32767

Returns

Promise<void>

#registerOnElementChangefunction

A callback that runs when:

  • the app element is created
  • the app element's data is updated
  • the user selects an existing app element

Parameters

#handlerAppElementChangeHandler<A>
Required

The callback to run when the app element changes.

Parameters

#appElementobject
Optional

Information about the app element that was changed.

Properties of appElement
#dataA
Required

The app element data in its most recent state.

#versionnumber
Required

The version number of the app.

Returns

void

Returns

void