Courier Controller

Courier is a Stimulus controller for transmitting data between elements.

Targets

Indicated by data-courier-target attribute.

Target Element(s) Description
source (any)
The element from which to copy data.
target (any)
The element to which to copy data.

Attributes

data- Attributes

All of these attributes are prefixed with "data-" in the attribute name.

Attribute Element(s) Default Value(s) Description
controller (any)
courier This attribute provides the Courier functionality.
action (any)
input
courier#update (string)

data-courier- Attributes

All of these attributes are prefixed with "data-courier-" in the attribute name.

Attribute Element(s) Default Value(s) Description
event (source or target)
The name of an event to fire when the target element is changed.

Events

courier: Events

These are custom events that the controller will fire when it takes certain actions.

All of these events are prefixed by "courier:".

Event Parameters Description
initialized Called any time that the controller is initialized.
connected Called any time that the controller is connected.
disconnected Called any time that the controller is disconnected.
copied source: Element
target: Element
Called any time that the controller has copied data from the source to the target element.

Methods

While it is recommended to use the controller via the attributes listed above, the following methods can be called directly if needed.

Method Returns Arguments Event(s) Description
transmit

Updates the target from the source to the target.