To utilize the MemoryEventBusAdapter, you must create instance of it.
MemoryEventBusAdapter
IMPORT_PATH: "@daiso-tech/core/event-bus/adapters"
"@daiso-tech/core/event-bus/adapters"
import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";const eventBusAdapter = new MemoryEventBusAdapter(); Copy
import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";const eventBusAdapter = new MemoryEventBusAdapter();
You can also provide an EventEmitter | EventEmitter that will be used for storing the data.
EventEmitter
import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";import { EventEmitter } from "node:events";const eventEmitter = new EventEmitter<any>();const eventBusAdapter = new MemoryEventBusAdapter(eventEmitter); Copy
import { MemoryEventBusAdapter } from "@daiso-tech/core/event-bus/adapters";import { EventEmitter } from "node:events";const eventEmitter = new EventEmitter<any>();const eventBusAdapter = new MemoryEventBusAdapter(eventEmitter);
The addListener method is used for adding listener for certain eventName.
addListener
listener
eventName
The dispatch method is used for dispatching one or multiple events.
dispatch
events
The removeListener method is used for removing listener for certain eventName.
removeListener
To utilize the
MemoryEventBusAdapter
, you must create instance of it.IMPORT_PATH:
"@daiso-tech/core/event-bus/adapters"