Documentation
    Preparing search index...

    Class EventEmitter<TArg>

    Expose ability to emit and subscribe to a single type of event.

    Type Parameters

    • TArg = void

      type of the event payload.

    Index

    Constructors

    Methods

    • Fires the event.

      Parameters

      • arg: TArg

        event payload.

      Returns void

      • This function will asynchronously wait for all its event handlers to return (or throw) before returning, but will not await any asynchronous portions.
      • Were any of the event handler to throw any error, this function would not throw. Instead, errors are thrown to the current SynchronizationContext.
    • Fires the event asynchronously.

      Parameters

      • arg: TArg

        event payload.

      Returns Promise<void>

      • This function will wait for all its event handlers to return (or throw) before returning, and will await any asynchronous portions.
      • Were any of the event handler to throw any error, this function would not throw. Instead, errors are thrown to the current SynchronizationContext.
    • Subscribes to the event.

      Parameters

      Returns Disposable

      a token used to cancel the event subscription.

      • Subscribing the same handler multiple times is allowed; they will be invoked multiple times.
      • If handler returns a PromiseLike value, depending on how the EventEmitter.invokeAsync is called, your event handler might be called concurrently (the 2nd invocation starts before the 1st invocation ends).

      Set up convention on what should happen if a handler is added/removed while the event is being fired.