Interface INopeEventEmitter<T, S, G, AD>

An EventEmitter is used to share Events in the System. Therefore the Eventemitter provides the method: emit, which will emit an event.

Observers subscribe to that event an will receive an notification using a callback and subscribing to an event (see subscribe). If they are temporarily are not interessed the observer can use the pause (and unpause) Methods to temporarily controll the subscription. If the subscription isnt used any more, the method unsubscribe will be used to unsubscribe from the emitter.

Subscriptions on INopeEventEmitter will only get informed on an updates. Events are not persitent.

To adapt and controll the events before publishing, a custom setter can be assigned (see setter). This setter is used to determine, whether the event should be published or not.

During subscribing to the emitter, you receive an INopeObserver

Export

INopeEventEmitter

Type Parameters

  • T = unknown

    The internal Datatype of the Emitter

  • S = T

    Datatype, the setContent method must receive

  • G = T

    Datatype, that will be during forwarding the event data.

  • AD extends IEventAdditionalData = IEventAdditionalData

    The Additional Event-Data, that observers will receive.

Hierarchy

Implemented by

Properties

disablePublishing: boolean

Flag to Disable Publishing of the emitter. This results in not inform the relevant subscriber / observers.

getter: ((value) => G)

Type declaration

    • (value): G
    • Helper to transform the data using a getter.

      Parameters

      • value: T

      Returns G

hasSubscriptions: boolean

Flag, showing if there exists any subscription this particular observer.

id: string

An id of the Observable. This might be usefull for debugging.

observerLength: number

Returns the amout of interessed Subscribers / Observers.

options: any

options.

setter: ((value, options?) => {
    data: T;
    valid: boolean;
})

Type declaration

    • (value, options?): {
          data: T;
          valid: boolean;
      }
    • Property, a custom setter.

      This setter is used to determine, whether the event should be published or not Therefore it is implemented as callback, which has to return the adpated data, and a flag, which shows whether the data is valid or not. If the data is marked es invalid, the event wont be published.

      If not required the setter must be set to null

      Parameters

      • value: S
      • Optional options: Partial<AD>

      Returns {
          data: T;
          valid: boolean;
      }

      • data: T
      • valid: boolean

Methods

  • Async Function to Wait for an Update until the given testCallback returns true. The testCallback defaultly test for true

    Returns

    Contains the Data, which firstly fullfilled the testCallback

    Parameters

    Returns Promise<G>

Generated using TypeDoc