Global event Overload
Sometimes it may be preferable to call multiple events with a single action (e.g. multiple error events that handle different HTTP status codes). This can be achieved by having multiple events with the same type but different names and file types.
In the following example, two such events of the same type are defined:
/event/myEvent1.json
{
"name": "myEvent1",
"content": {
"@ignore": [
"globalEventTypeMatch"
],
"type": "myEvent",
"actions": [
{
"type": "showMessage",
"params": {
"text": "My event 1 has been triggered."
}
}
]
}
}
/event/myEvent2.json
{
"name": "myEvent2",
"content": {
"@ignore": [
"globalEventTypeMatch"
],
"type": "myEvent",
"actions": [
{
"type": "showMessage",
"params": {
"text": "My event 2 has been triggered."
}
}
]
}
}
By adding @ignore
and globalEventTypeMatch
we can ignore the mismatch between type
and name
and trigger both of these events simultaneously by calling myEvent
only once.