Custom Events

Custom events are similar to page events, except that they are not limited to lifecycles. Their event listeners can be defined in a page, flow, or application.

An event name is defined by the user, and is explicitly fired by the application, using the event Actions provided, in the context of a page.

Custom event listeners are defined in the page or flow under the eventListeners property.

One difference between custom events and page events is that they 'bubble' up the containment hierarchy. Any event listeners in a given flow or page for the event are executed before looking for listeners in the container's parent. The order of container processing is:
  • The page from where the event is fired.

  • The flow containing the page.

  • The page containing the flow.

  • Recursively up the containment, ending with the application.

Custom and system event behavior can be modified using the stopPropagation property, which prevents the event from bubbling to this event listener's container's parents.

Example 1-82 stopPropagation Example

"eventListeners": {
  "customEventTwo": {
    "stopPropagation": "{{ $event.type === 'info' }}"
    "chains": [
      {
        "actionsId": "handleEventInMod2PageChain",
        "parameters": {
          "eventPayload": "{{ $event }}"
        }
      }
    ],
  }... 

vbNotification Events

The vbNotification event is a built-in custom event, rather than a page, flow, or application event, as it is an event only explicitly fired by the application using the action 'vb/action/builtin/fireNotificationEventAction' (see Fire Notification Event Action)

The payload is an object with these properties:

  • "summary": a short summary, subject, or title

  • "message": any text meaningful to the application

  • "displayMode": "persist" or "transient"

  • "type": "error", "warning", "info", or "confirmation"

  • "key": an optional GUID, which may be useful for the UI. If not provided, one is generated and provided in the payload.