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 {
  publish(event: VendureEvent) => void;
  subscribe(type: Type<T>, handler: EventHandler<T>) => UnsubscribeFn;
}

Members

publish

method
type:
(event: VendureEvent) => void

Publish an event which any subscribers can react to.

subscribe

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

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