Created
March 8, 2022 13:10
-
-
Save GoodnessEzeokafor/383844622e8eb3e0866b584bc47649a7 to your computer and use it in GitHub Desktop.
Event listener
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******** | |
* This module will help us decouple alot of functionality like | |
* * sending emails | |
* * sending sms | |
* * sending notification | |
* * tracking users activities | |
* | |
*/ | |
import * as events from "events" | |
import { sendEmail } from "../lib/nodemailer-lib"; | |
import { EMAIL_PAYLOAD } from "../types/models/email"; | |
events.EventEmitter.defaultMaxListeners = 800; | |
class EventClass extends events.EventEmitter { } | |
// create instance | |
const event = new EventClass() | |
const allEvents = () => { | |
console.log("@listening to all events") | |
// event listener for audit | |
event.on("send-email", async (payload: EMAIL_PAYLOAD) => { | |
}) | |
} | |
export { event, allEvents } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment