-->

# Trigger

A trigger is similar to a microprogram, which requires certain events and conditions to run the instructions programmed in the trigger, so it is called a "trigger".

The composition of the trigger?

A trigger consists of the following three parts

1.incident
2.Condition
3.action

# incident

Events are the only way to run trigger actions. Whenever an event is added to a trigger and runs, the trigger will first register a listener event. When something performs some activity and is monitored by the listener event, the action in the trigger will be executed

Still don't understand? Look at the following example.


Trigger content[

incident:
The time is 12:00

action: ExecutionAction

interpret: When the time reaches 12:00, the trigger executes the action.

# Condition

The word "condition" is easy to understand and will not be introduced here. Let's look at the following example.


Trigger content[

incident:
The Time is 12:00

Condition: The Weather is Sunny

action: ExecutionAction

interpret: When the time reaches 12:00, if the current weather is "sunny", the action is performed. If the time reaches 12:00 and the weather is "rainy", no action will be taken.

# action

"Action" is an important content that cannot be missed in the entire trigger. It determines the role of the trigger when it is executed. If there is no action, the trigger will not do anything even if the event is triggered.

Last update: 2020-11-28 15:40:31