Dispatching events
By default, EventType is set to string. This means that you can create and handle any events you want.
Let's say you have created a Users plugin with login and create methods.
Now you can notify all the other plugins on the server that something has happened. Here's how you can do that:
dispatcher.Dispatch(“users.OnUserLogin”, ctx, {uid, username})
It is important to add an event namespace like users. so that other plugins can distinguish events from different plugins. Of course, the namespace must be unique.
Last modified: 21 December 2024