Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventPortal

Controller class to abstract the events subscription and publishing actions.

Hierarchy

Index

Constructors

constructor

Properties

Protected eventTarget

eventTarget: EventTargetFoundation = new EventTargetFoundation()
property

{EventTargetFoundation} eventTarget - EventTargetFoundation instance used to publish/subscribe events

Protected notificationStrategy

notificationStrategy: NotificationStrategyFoundation
property

{NotificationStrategyFoundation} notificationStrategy - NotificationStrategyFoundation instance used on subscribe time to encapsulate notifications strategies

Accessors

notificationStrategyType

  • get notificationStrategyType(): string
  • Getter method to retrieve the notification Strategy Type.

    Ex:

     const eventPortal = new EventPortal(reduxStrategy);
     eventPortal.notificationStrategyType; // return 'Redux'

    Returns string

Methods

listenEvent

  • listenEvent(eventName: string, strategyCallBack?: any): EventPortal
  • Method to register/subscribe listeners to events. After this method execution the listeners/subscribers will be notified about events occurrences using the corresponding strategyCallBack.

    Parameters

    • eventName: string

      The name of the event of interest

    • Default value strategyCallBack: any = this.notificationStrategy

      Payload object with data to send into the published event

    Returns EventPortal

notifyEvent

  • notifyEvent(eventName: string, eventPayload: any): EventPortal
  • Method to publish events and notify subscribers about events occurrences.

    Parameters

    • eventName: string

      The name of the event to publish

    • eventPayload: any

      Payload object with data to send into the published event

    Returns EventPortal

Generated using TypeDoc