Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventProcessor

Overview

Each EventProcessor manages its own subscriptions, handling the addition, emission, and removal of events. It uses a map where event names are keys, and values are Event objects that hold detailed event information and subscriptions.

An EventProcessor handles three main functionalities:

  • Subscribing to Events: Registration of a callback function that will be executed when that event occurs.
  • Emitting Events: Notifying other applications or parts of the same application about certain actions or changes.
  • Managing Event Subscriptions: Mapping subscribed events and their corresponding callbacks, ensuring that events are properly handled and dispatched.

Understanding Event Types

  • Predefined Zowe Events: Zowe provides a set of predefined shared and user events that can be watched.
  • Custom Events: Applications can define their own shared and user events, allowing for custom event-driven behavior.
export

Hierarchy

  • EventProcessor

Index

Constructors

constructor

Properties

appName

appName: string

eventTimes

eventTimes: Map<string, string>

logger

logger: Logger

processorType

processorType: IProcessorTypes

subscribedEvents

subscribedEvents: Map<string, Event> = new Map()

Methods

Private _subscribe

Private emit

  • emit(eventName: string): void

emitEvent

  • emitEvent(eventName: string): void
  • Emits an event by updating its timestamp and writing event data.

    throws

    {ImperativeError} If the processor does not have the correct permissions to perform this action.

    throws

    {ImperativeError} - If the event cannot be emitted.

    Parameters

    • eventName: string

      The name of the event to emit.

    Returns void

emitZoweEvent

  • emitZoweEvent(eventName: string): void
  • Specifically emits Zowe-related events, updating timestamps and handling data.

    internal

    Internal Zowe emitter method

    throws

    {ImperativeError} If the processor does not have the correct permissions to perform this action.

    throws

    {ImperativeError} - If the event cannot be emitted.

    Parameters

    • eventName: string

      The name of the Zowe event to emit.

    Returns void

subscribeShared

subscribeUser

unsubscribe

  • unsubscribe(eventName: string): void
  • Unsubscribes from an event, closing file watchers and cleaning up resources.

    throws

    {ImperativeError} If the processor does not have the correct permissions to perform this action.

    throws

    {ImperativeError} - If unsubscribing fails.

    Parameters

    • eventName: string

      The name of the event to unsubscribe from.

    Returns void

Generated using TypeDoc