EventBus

EventBus

EventBus

Package: @vendure/core File: event-bus.ts

The EventBus is used to globally publish events which can then be subscribed to.

Signature

class EventBus implements OnModuleDestroy {
  publish(event: T) => void;
  ofType(type: Type<T>) => Observable<T>;
  subscribe(type: Type<T>, handler: EventHandler<T>) => UnsubscribeFn;
}

Members

publish

method
type:
(event: T) => void
Publish an event which any subscribers can react to.

ofType

method
type:
(type: Type<T>) => Observable<T>
Returns an RxJS Observable stream of events of the given type.

subscribe

method
type:
(type: Type<T>, handler: EventHandler<T>) => UnsubscribeFn

Deprecated: use ofType() instead.

Subscribe to the given event type. Returns an unsubscribe function which can be used to unsubscribe the handler from the event.