You can emit and listen the specific events with EventEmitter.emit
and EventEmitter.on
methods. For more usages and documentation:
import EventEmitter from "@services/event-emitter";
// Second parameter can be anything; object, string, boolean, etc...
EventEmitter.emit("MESSAGE_RECEIVED", "Event emitter message, this can be object or anything")
import EventEmitter from "@services/event-emitter";
// Second parameter can be anything; object, string, boolean, etc...
EventEmitter.on("MESSAGE_RECEIVED", (message: string) => {
console.log("Event Emitter Data: ", message)
});