alt.once

Subscribes to a client event with specified listener, which only triggers once. Once the event is triggered it can never be triggered again.

Declaration

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

Usage

alt.once('someEvent', someCallbackFunction);

Real World Example

alt.once('someEvent', () => {
    alt.log(`Called once.`);
}

alt.emit('someEvent');

These examples assume you have imported alt from alt-client.

results matching ""

    No results matching ""