alt.on
Used to listen to built-in events or custom events.
Can also be used to create custom events that can be called when an emit
is invoked. See alt.emit for more information.
Declaration
alt.on<K extends keyof IServerEvent>(eventName: K, listener: IServerEvent[K]): void
Usage
alt.on('someEventName', someCallbackFunction);
Real World Example
alt.on('someEventName', (someArgument) => {
console.log('Got custom event!');
});
These examples assume you have imported alt
from alt-client
.