ImageElement

init

Creates an ImageElement instance.

NameTypeRequiredDefaultDescription

imageUrl

string

true

The url for the image.

altText

string

false

"" (empty string)

The alt text for the image. If alt text is not provided in the constructor, it must be provided using the alt method before serializing.

Return: The ImageElement instance.

alt

Sets the alt text for the ImageElement instance.

NameTypeRequiredDefaultDescription

altText

string

true

The alt text for the ImageElement.

Return: The ImageElement instance.

getMemento

Converts the ImageElement instance to a serializable format.

NameTypeRequiredDefaultDescription

No arguments

Return: (struct) A struct representing this ImageElement instance.

{
    "type": "image",
    "image_url": "https://placekitten.com/200/300",
    "alt_text": "A cute kitten"
}

Last updated