Performs actions based on the presence of an element or on conditions of the content of the element.
Options:
Option | Required | Description | Example |
---|---|---|---|
condition | true | (object) A brief description on condition is given in table below. | { |
ifTrue | false | (array) set of actions to be performed if the condition is true. | [ |
ifFalse | false | (array) set of actions to be performed if the condition is false. | [ |
Description on option condition
Option | Required | Description | Example |
---|---|---|---|
querySelector | true | element to check if it exists in the page | .updated |
compareValue | false | The value to compare with | 2021-05-01 |
compareOperation | false | Type of condition. Possible Values : Element Exists | | Date Earlier Than |
Example 1: Appends message based on the date present in the given element
{
"action": "condition",
"options": {
"ifTrue": [
{
"action": "message",
"options": {
"message": "new post",
"messageName": "m1"
}
}
],
"ifFalse": [
{
"action": "message",
"options": {
"message": "old post",
"messageName": "m1"
}
}
],
"condition": {
"compareValue": "2021-05-01",
"querySelector": ".updated",
"compareOperation": "Date Earlier Than"
}
}
},