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.


alt.on<K extends keyof IServerEvent>(eventName: K, listener: IServerEvent[K]): void


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.

results matching ""

    No results matching ""