UNPKG

@unchainedshop/core-events

Version:

This package defines the event module which ensures the emitted events are written to the database as an Event History and offers a core module to search for events.

18 lines 591 B
import { getEmitHistoryAdapter, setEmitHistoryAdapter } from '@unchainedshop/events'; export const configureEventHistoryAdapter = (createFn) => { if (!getEmitHistoryAdapter()) { const adapter = { subscribe: () => { // Do nothing }, publish: async (eventName, { payload }) => { await createFn({ type: eventName, payload, }); }, }; setEmitHistoryAdapter(adapter); } }; //# sourceMappingURL=configureEventHistoryAdapter.js.map