Emitter
The Emitter construct enables reactive communication between different parts of an application. It ensures that updates to shared data are instantly propagated to all subscribed components (via Subscriptions). This allows seamless data synchronization without direct dependencies between components(master layouts, interfaces, components).
Emitter enables publishing of updates to a subject. All the consumers(subscriptions) that subscribe to this subject will receive the update.
Key Features
- Real-Time Data Flow – Changes in a shared value are immediately reflected across all subscribed components.
- Decoupled Communication – Components do not need direct references to interact, improving modularity.
- Efficient Event Handling – Enables event-driven updates without manual data polling.
How It Works
- Emitter Publishes an Update – The emitter pushes an update to a subject (using Emitter construct).
- Subscribers Receive the Update – All components (master layouts, interfaces, components) subscribed to the subject (using subscribe construct) automatically receive the updated data through subscription handlers.
- Components React to Changes – UI elements (in master layouts, interfaces, components), business logic adjust dynamically based on the received update.
Example Use Case
- Global State Management – Theme Switching in an Application.
- Live Data Updates – Updating a notification badge when new messages arrive.
- Component Communication – Sending real-time updates between a parent and child component without direct coupling.
The Emitter Construct ensures smooth and scalable communication across an application, reducing dependencies and improving responsiveness.
Emitter Properties
| Property | Description | Comments |
|---|---|---|
| Label | Labels help developers quickly understand each step in the logic flow without examining the details of the construct. | It is recommended to provide a simple precise label that improves the logic flow readability. |
| Instance Id* | Unique identifier of the target workflow instance. | Ensures the event is sent to the correct instance. |
| Event Name* | Name of the event being triggered. | |
| Input* | Data payload associated with the event. | |
| Comment | Indicate if this construct should be commented out. Choose Yes or No. | If marked as Yes, the construct is treated as a commented expression and ignored in code generation. |
| Description | Enables external systems to send signals to a workflow instance that is waiting for an external event. | Helps in understanding Raise Event significance. |
'Note: ' + ($args[0].Groups[1].Value -replace '\r?\n', ' ')