Skip to content

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

PropertyTypeDefaultDescription
eventNamestring--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:

  1. The server-side node marks the intent to emit an event.
  2. The renderer generates JS that fires a CustomEvent on the component's DOM element.
  3. 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") --> Output

The parent page listens for itemAdded and refreshes its item list.

Context --> Update Row --> Emit Event (eventName: "editComplete") --> Output

The 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.