Image

Image

Class that reactively updates the image of an img element whenever the state of its owner changes.

Constructor

new Image(owner, element, options)

Source:
Parameters:
Name Type Description
owner Ripe The Ripe instance to be shown.
element Object The img element that should be updated.
options Object An object with options to configure the image, such as: - 'showInitials' - A Boolean indicating if the owner's personalization should be shown (defaults to 'true¨). - 'initialsBuilder' - A function that receives the initials and engraving as Strings and the img element that will be used and returns a map with the initials and a profile list. - 'frame' - The Ripe instance frame to display (defaults to '0'). - 'size' - The image size in pixels (defaults to '1000'). - 'width' - The image width in pixels (defaults to 'null', meaning it will fallback to 'size'). - 'height' - The image height in pixels (defaults to 'null', meaning it will fallback to 'size'). - 'crop' - A Boolean indicating if it is to crop the image composition.

Methods

cancel(options) → {Boolean}

This function is called (by the owner) whenever the current operation in the child should be canceled this way an Image is not updated.
Source:
Parameters:
Name Type Description
options Object Set of optional parameters to adjust the Image.
Returns:
Type:
Boolean
If an effective operation has been performed or if instead no cancel logic was executed.

deinit()

The Image deinitializer, to be called (by the owner) when it should stop responding to updates so that any necessary cleanup operations can be executed.
Source:

init()

The Image initializer, which is called (by the owner) whenever the Image is going to become active. Sets the various values for the Image taking into owner's default values.
Source:

resize(size)

Resizes the Image's DOM element to `size` pixels, both the width and the height of the image will reflect this value.
Source:
Parameters:
Name Type Description
size String The number of pixels to resize to.

setComposeLogic(composeLogic)

Updates the Image's `setComposeLogic` flag that indicates if the initials builder logic should only run on the server side.
Source:
Parameters:
Name Type Description
composeLogic String If the compose (initials builder) logic should be executed or not, in case this value is defined the local initials builder logic should not be executed.

setFrame(frame, options)

Updates the frame that the Image is referring to.
Source:
Parameters:
Name Type Description
frame String The Ripe instance frame to display.
options Object An object with options to configure the setting of the frame.

setInitialsBuilder(builder, options)

Updates the Image's `initialsBuilder` function.
Source:
Parameters:
Name Type Description
builder function The new `initialsBuilder` function to be used by the Image.
options Object An object with options to configure the setting of the `initialsBuilder`.

setNoAwaitLayout(noAwaitLayout)

Updates the Image's `noAwaitLayout` flag that indicates if the current update should not wait the completion of the previous one.
Source:
Parameters:
Name Type Description
noAwaitLayout String If the layout operations should wait for the complete execution of the previous ones.

setShowInitials(showInitials)

Updates the Image's `showInitials` flag that indicates if the initials should be display in the image.
Source:
Parameters:
Name Type Description
showInitials String If the image should display initials.

update(state, options) → {Boolean}

This function is called (by the owner) whenever its state changes so that the Image can update itself for the new state.
Source:
Parameters:
Name Type Description
state Object An object containing the new state of the owner.
options Object Set of optional parameters to adjust the Image.
Returns:
Type:
Boolean
If an effective operation has been performed by the update operation.

updateOptions(options, update)

Updates the Image's current options with the ones provided.
Source:
Parameters:
Name Type Description
options Object Set of optional parameters to adjust the Image, such as: - 'format' - The format of the image, (eg: png, jpg, svg, etc.). - 'crop' - A Boolean indicating if the resulting image should be cropped. - 'initialsGroup' - The group in which the image initials belongs to.
update Boolean If an update operation should be executed after the options updated operation has been performed.