SAP Analytics Cloud controls the lifecycle of a custom widget. Lifecycle functions are invoked when the widget is updated, resized, or destroyed. These functions are called custom widgets lifecycle functions, such as:
- onCustomWidgetResize
- onCustomWidgetBeforeUpdate
- onCustomWidgetAfterUpdate
- onCustomWidgetDestroy
Whenever the state of the widget changes (for example, size, properties, or data), SAP Analytics Cloud triggers specific lifecycle functions in the Web Component.
Exercise
In this exercise, you will implement selected lifecycle functions and observe how the widget reacts when its size changes.
You will:
- modify the main.js file to add lifecycle handling to the custom widget
- upload the custom widget to SAP Analytics Cloud
- test the widget by changing its size
Result
The widget reacts correctly to lifecycle events triggered by SAP Analytics Cloud.