@theredhead — Frontend Library - v1.0.0
    Preparing search index...

    Minimal typed event emitter — a lightweight alternative to RxJS Subject for discrete notifications.

    const event = new Emitter<RowChangedNotification>();

    // Consumer (e.g. in a component):
    const unsub = event.subscribe(n => console.log(n.rowIndex));
    destroyRef.onDestroy(unsub);

    // Producer (e.g. in a datasource):
    event.emit({ rowIndex: 42 });

    Type Parameters

    • T

      The event payload type.

    Index

    Constructors

    Methods

    Constructors

    • Type Parameters

      • T

        The event payload type.

      Returns Emitter<T>

    Methods

    • Fires the event, invoking all registered listeners synchronously. Listener errors are caught individually so one failing handler never prevents the remaining listeners from executing. Caught errors are reported via console.error so they still surface in logs without causing unhandled exceptions.

      Parameters

      • event: T

        The payload to deliver to every listener.

      Returns void

    • Registers a listener that is invoked every time the event fires.

      Parameters

      • fn: (event: T) => void

        Callback receiving the event payload.

      Returns () => void

      A teardown function that removes the listener when called. Designed to be passed directly to DestroyRef.onDestroy().