To utilize the MemoryEventBusAdapter, you must create instance of it.
import { MemoryEventBusAdapter } from "@daiso-tech/core";const eventBusAdapter = new MemoryEventBusAdapter(client); Copy
import { MemoryEventBusAdapter } from "@daiso-tech/core";const eventBusAdapter = new MemoryEventBusAdapter(client);
You can also provide an EVentEmitter.
import { MemoryCacheAdapter } from "@daiso-tech/core";import { EventEmitter } from "node:events";const eventEmitter = new EventEmitter();const eventBusAdapter = new MemoryCacheAdapter("@global", eventEmitter); Copy
import { MemoryCacheAdapter } from "@daiso-tech/core";import { EventEmitter } from "node:events";const eventEmitter = new EventEmitter();const eventBusAdapter = new MemoryCacheAdapter("@global", eventEmitter);
The addListener method is used for adding listener for certain eventName.
The dispatch method is used for dispatching one or multiple events.
The removeListener method is used for removing listener for certain eventName.
To utilize the MemoryEventBusAdapter, you must create instance of it.
Example
You can also provide an EVentEmitter.
Example