Global events
Global events in Wized are system-wide event listeners that react dynamically to specified conditions, triggering predefined actions when those conditions are met. Unlike element-based events, Global events are not tied to a specific element or user interaction they execute automatically whenever the defined condition evaluates as true
.
This allows you to create reactive workflows, where logic runs in the background based on application state, API responses, or custom triggers.
How global events work
Each Global event consists of two main components:
Trigger
- Custom condition
- Request finished
- Attribute present
- Page starts loading
- Page finishes loading
Conditional
- The validation rule that determines when the event is executed.
- This condition is continuously evaluated in real time by Wized.
Actions
- A set of tasks that will be executed when the event is triggered.
- These actions can include executing requests, modifying variables, among others.
Example
Execute an API request when a user logs in
Trigger: Request finishes
Condition: The ok
property of a login request becomes true
.
Actions:
- Fetch user data from an API.
- Store the user’s role in a variable.
- Redirect to a dashboard page.
Best Practices
- Use Global events for background automation rather than user-triggered actions.
- Ensure conditions are specific to prevent unintended executions.
- Leverage multiple actions within a single event to streamline workflows.
- Test conditions manually to verify they trigger as expected.