createEventBus

cart · /core·function

In-process event bus used by the cart kernel to broadcast lifecycle events to UI layers (React store, analytics, tab sync). Delivery is fire-and-forget via queueMicrotask so that emitting never blocks the caller and handler failures cannot poison the mutation pipeline.

Signature

@nordcom/commerce-cart

Parameters

NameTypeDescription
opts{ logger: ILogger }

Returns

A with on (returns dispose) and emit.

Example

const bus = createEventBus({ logger: consoleLogger });
const off = bus.on('cart.created', (e) => console.log('created', e.cart.id));
bus.emit({ type: 'cart.cleared' });
off();

RunCartAdapterContractOpts runCartAdapterContract CartCapabilityUnsupportedError CartError CartNotFoundError CartProviderError CartUserError CartAdapter

Sourceevents.ts:89Edit the JSDoc directly

On this page