Declare signals that resources can emit and listen to.
- signal
- argument
signals do
signal :post_created do
argument :post_id, :uuid, allow_nil?: false
end
end
signal nameDeclares a signal, and defines a struct for its arguments.
For a signal named :post_created in MyApp.Signals, this is MyApp.Signals.PostCreated.
signal :post_created do
argument :post_id, :uuid, allow_nil?: false
end
| Name | Type | Default | Docs |
|---|---|---|---|
name{: #signals-signal-name .spark-required} |
atom |
The name of the signal. |
| Name | Type | Default | Docs |
|---|---|---|---|
phase{: #signals-signal-phase } |
:before_action | :after_action | :after_transaction |
:after_action |
The phase of the emitting action during which the signal may be emitted. |
description{: #signals-signal-description } |
String.t |
A description of the signal. |
argument name, typeAn argument of the signal, provided by the emitter.
argument :post_id, :uuid, allow_nil?: false
| Name | Type | Default | Docs |
|---|---|---|---|
name{: #signals-signal-argument-name .spark-required} |
atom |
The name of the field. | |
type{: #signals-signal-argument-type .spark-required} |
module |
The type of the field. |
| Name | Type | Default | Docs |
|---|---|---|---|
constraints{: #signals-signal-argument-constraints } |
keyword |
[] |
Constraints for the type. |
allow_nil?{: #signals-signal-argument-allow_nil? } |
boolean |
true |
Whether the field may be nil. |
default{: #signals-signal-argument-default } |
any |
A default value for the field. | |
description{: #signals-signal-argument-description } |
String.t |
A description of the field. |
Target: Ash.Signals.Field
Target: Ash.Signals.Signal