Custom Events
Table of Content
aoi.js has a built-in way to create Custom Events, these can be used for various things. This guide will be covering their usage, how they work, and an example.
CustomEvent Class
Emitting Custom Events
To emit a previously created custom event you have to options.
Node.js / Discord.js Method
You can use the native node.js
method by using emit
:
Aoi.js Function Method
On the other side you have the aoi.js method with functions:
It would basically do the same as the node.js method.
Example Usage of Custom Events
Inside of aoi.js command files or aoi.js related code you can use the $eventEmit
& $eventData
functions to interact with created events.
Would do the same as
Both emit the created log
event, which causes Hello!
to appear in your console.