Skip to content

Instantly share code, notes, and snippets.

@GoodnessEzeokafor
Created March 8, 2022 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GoodnessEzeokafor/383844622e8eb3e0866b584bc47649a7 to your computer and use it in GitHub Desktop.
Save GoodnessEzeokafor/383844622e8eb3e0866b584bc47649a7 to your computer and use it in GitHub Desktop.
Event listener
/********
* 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