signals
Declare signals that resources can emit and listen to.
Nested DSLs
- signal
- argument
Examples
signals do
signal :post_created do
argument :post_id, :uuid, allow_nil?: false
end
end
signals.signal
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.
Nested DSLs
Examples
signal :post_created do
argument :post_id, :uuid, allow_nil?: false
end
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the signal. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
phase | :before_action | :after_action | :after_transaction | :after_action | The phase of the emitting action during which the signal may be emitted. |
description | String.t | A description of the signal. |
signals.signal.argument
argument name, typeAn argument of the signal, provided by the emitter.
Examples
argument :post_id, :uuid, allow_nil?: falseArguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the field. | |
type | module | The type of the field. |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
constraints | keyword | [] | Constraints for the type. |
allow_nil? | boolean | true | Whether the field may be nil. |
default | any | A default value for the field. | |
description | String.t | A description of the field. |
Introspection
Target: Ash.Signals.Field
Introspection
Target: Ash.Signals.Signal