Answer the question
In order to leave comments, you need to log in
How to create your own events?
Many libraries have the ability to listen to any events occurring somewhere. For example, in ready-made libraries for chatbots, you can do something like ..
client.on("message", callback())
But how to make your own events and subscribe to them in another module? For example, a certain message came or a certain event happened.. Which would trigger the "abracadabra" event in our "nash_client" event. In another module, we could write:
nash_client.on("abracadabra", callback())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question