Function ofType

  • Filter a stream of events by a event creator type

    Type Parameters

    • T

    Parameters

    • eventCreator: EventCreator<T, ActorEvent<unknown, Event<any>>>

      we want to filter by import { ofType, createEvent } from "reactive-actor"; import { tap, ignoreElements, takeUntil } from "rxjs";

      const logUser = createEvent<{ id: string }>('Log User');

      class UserActor extends Actor { private readonly logUser$ = this.messages$.pipe( ofType(logUser), tap(({ payload }) => console.log(payload)), ignoreElements(), takeUntil(this.stop$) );

      constructor() { super('userActor'); this.logUser$.subscribe(); } }

    Returns OperatorFunction<Event, ActorEvent<T>>

Generated using TypeDoc