Need help with Event's

File 1:

class Client {
    constructor() {
       this.login = (token) => {
         this.emit("ready", this)

module.exports.Client = Client;

file 2:

let xx = require("file_dir")
let client = new xx.Client();
client.on("ready", () => console.log("ready"))

I get 2 errors, client.on is not a functionandthis.emit is not a function`

I am no expert on this, but I have found an article that may help.

1 Like

I was looking for an article that was actually good, that explained it properly and couldn’t, the article you linked help me! Thank you!

1 Like