Appearance
Emit Event
The Emit Event node dispatches a named custom event from a child component to its parent. Use it to enable communication between reusable components -- for example, notifying the parent when a form inside a child component is submitted.
Configuration
| Property | Type | Default | Description |
|---|---|---|---|
eventName | string | -- | Required. The name of the event to emit (e.g., itemSaved, formSubmitted). |
Input
Accepts any data type. The input flows through unchanged.
Output
Returns the input data unchanged. The event emission is a side effect handled by the frontend JavaScript layer.
How It Works
The Emit Event node is a marker -- it tells the WP-Nexus renderer to generate JavaScript that dispatches a custom DOM event. The actual event dispatch happens on the client side:
- The server-side node marks the intent to emit an event.
- The renderer generates JS that fires a
CustomEventon the component's DOM element. - The parent component (using a Component Ref widget) can listen for this event and trigger its own actions.
Example Use Cases
Child form notifies parent to refresh data
A reusable "Add Item" form component emits an event after saving:
Context --> Validate --> Save Row --> Emit Event (eventName: "itemAdded") --> OutputThe parent page listens for itemAdded and refreshes its item list.
Modal component signals completion
Context --> Update Row --> Emit Event (eventName: "editComplete") --> OutputThe parent listens for editComplete to close the modal and refresh the data.
TIP
Emit Event is the recommended way for child components to communicate with parents. It keeps components decoupled -- the child does not need to know about the parent's data structure.