OutletButton

OutletButton

OutletButton Stimulus Controller

Manages inter-controller communication through data passing and event dispatching. Provides a button component that can collect data from other controllers and dispatch custom events for complex workflow coordination.

Values:

  • btnData: String - JSON payload in data-outlet-btn-btn-data-value (parsed safely)
  • requireData: Boolean - Whether data is required for button activation

Constructor

new OutletButton()

Source:

Methods

addBtnData(data)

Description:
  • Add data to button for communication

Source:
Parameters:
Name Type Description
data Record.<string, unknown>

Data object to associate with button

addListener(callback)

Source:
Parameters:
Name Type Description
callback function

Event handler function

btnDataValueChanged()

Description:
  • Handle button data value changes Updates button state based on data availability and requirements

Source:

fireNotice(event)

Description:
  • Fire custom event with button data

Source:
Parameters:
Name Type Description
event Event

Click event from button

getBtnData() → {Record.<string, unknown>}

Source:
Returns:
Type
Record.<string, unknown>

parseBtnData(raw) → {Record.<string, unknown>}

Source:
Parameters:
Name Type Description
raw string | null | undefined

Attribute value from data-outlet-btn-btn-data-value

Returns:
Type
Record.<string, unknown>

removeListener(callback)

Source:
Parameters:
Name Type Description
callback function

Event handler function to remove