(key: string): any
(all: boolean): any
(arguments: {
all?: boolean,
key?: string,
default?: any
}): any
The _event
operator gets a value from the event
object. The event
object is a data object provided to an action
by an event
. This object is also available to a request or connection
called by the Request
action.
Arguments
string
If the _event
operator is called with a string argument, the value of the key in the event
object is returned. If the value is not found, null
is returned. Dot notation and block list indexes are supported.
boolean
If the _event
operator is called with boolean argument true
, the entire event
object is returned.
object
all: boolean
: Ifall
is set totrue
, the entireevent
object is returned. One ofall
orkey
are required.key: string
: The value of the key in theevent
object is returned. If the value is not found,null
, or the specified default value is returned. Dot notation and block list indexes are supported. One ofall
orkey
are required.default: any
: A value to return if thekey
is not found inevent
. By default,null
is returned if a value is not found.
Examples
Get the value of my_key
from event
:
_event: my_key
_event:
key: my_key
Returns: The value of my_key
in event
.
Get the entire event
object:
_event: true
_event:
all: true
Returns: The entire event
object.
Dot notation:
Assuming args:
my_object:
subfield: 'Value'
then:
_event: my_object.subfield
_event:
key: my_object.subfield
Returns: "Value"
.
Return a default value if the value is not found:
_event:
key: might_not_exist
default: Default value
Returns: The value of might_not_exist
, or "Default value"
.
Block list indices:
Assuming event
:
my_array:
- value: 0
- value: 1
- value: 2
then:
_event: my_array.$.value
Returns: 0
when used from the first block (0th index) in a list.