alt.on
Used to stop listening to built-in events or custom events.
Declaration
alt.off(eventName: string, listener: (...args: any[]) => void): void
Usage
alt.off('someEventName', someCallbackFunction);
Real World Example
This example shows that an event will automatically turn itself off after the first call.
function someCallbackFunction() {
alt.off('someEventName', someCallbackFunction);
}
alt.on('someEventName', someCallbackFunction);
These examples assume you have imported alt
from alt-client
.