A base Command implementation.

Your subclass should override the execute method where your business logic will handle the Notification.

Hierarchy (view full)

Implements

Constructors

Properties

multitonKey: string

The Multiton Key for this app

MULTITON_MSG: string = "multitonKey for this Notifier not yet initialized!"

Message Constants

Accessors

Methods

  • Fulfill the use-case initiated by the given Notification.

    In the Command Pattern, an application use-case typically begins with some user action, which results in a Notification being broadcast, which is handled by business logic in the execute method of an Command.

    Parameters

    • notification: INotification

      The notification containing the data or command details to be processed.

    Returns void

  • Initialize this Notifier instance.

    This is how a Notifier gets its multitonKey. Calls to sendNotification or to access the facade will fail until after this method has been called.

    Mediators, Commands or Proxies may override this method in order to send notifications or access the Multiton Facade instance as soon as possible. They CANNOT access the facade in their constructors, since this method will not yet have been called.

    Parameters

    • key: string

      the multitonKey for this Notifier to use

    Returns void

  • Create and send an Notification.

    Keeps us from having to construct new Notification instances in our implementation code.

    Parameters

    • notificationName: string

      The name of the notification to be sent.

    • Optionalbody: any

      Optional data to be included with the notification.

    • Optionaltype: string

      Optional type of the notification.

    Returns void