In a web application, each element has a set of triggers. With their help, you can configure various business processes that will start under certain conditions.
All elements have a set of common triggers called the element life cycle:
- onCreate – runs when the element is created on the page;
- onShow – runs when the component changes its state to visible (displayed on the page);
- onHide – runs when the component changes its state to hidden (stops being displayed);
- onDestroy – runs before the component is destroyed.
Here are the triggers on the button element as an example:
Let's take a closer look at each trigger. We will use Notification blocks to display the launch of triggers in the interface to do this.
onCreate
Let's start with the onCreate trigger and set up a notification for it.
Now, the Notification will appear every time the onCreate trigger runs. It will work in the following cases:
- When the user visits the page;
- After page refresh.
Let's set up similar BPs for other triggers:
onShow
The onShow trigger will run:
- When the user enters the page, and the element's Visible field is set to True;
- After refreshing the page, and the element's Visible field is set to True;
- When an element changes its Visible state from False to True.
onHide
The onHide trigger will run:
- When the user leaves the page the element was on.
- When an element changes its Visible state from True to False.
onDestroy
The onDestroy trigger will run:
- When the user leaves the page the element was on.
- When an element is removed from the page.