UNPKG

@nativewrappers/fivem

Version:

Native wrappers and utilities for use with FiveM.

67 lines (66 loc) 3.03 kB
/** * Disables pretty printing in error messages */ export declare const DisablePrettyPrint: () => boolean; export declare enum Binding { /** * No one can call this */ None = 0, /** * Server only accepts server calls, client only client calls */ Local = 1, /** * Server only accepts client calls, client only server calls */ Remote = 2, /** * Accept all incoming calls * Server only accepts client calls, client only server calls */ All = 3 } /** * Registers the Event call for {@link eventName} to this method. * * This has internal pretty-printing to make errors easier to track, if * you want to disable this you will need to call {@link DisablePrettyPrint}, or if you're * using esbuild you can add `REMOVE_EVENT_LOG` to your drop label {@link https://esbuild.github.io/api/#drop-labels} * @param eventName the event to bind to */ export declare function CfxEvent(eventName: string, binding?: Binding): (originalMethod: any, context: ClassMethodDecoratorContext) => void; /** * Registers the Event call for {@link eventName} to this method. * * This has internal pretty-printing to make errors easier to track, if * you want to disable this you will need to call {@link DisablePrettyPrint}, or if you're * using esbuild you can add `REMOVE_EVENT_LOG` to your drop label {@link https://esbuild.github.io/api/#drop-labels} * * @param eventName the event to bind to */ export declare function Event(eventName: string): (originalMethod: any, context: ClassMethodDecoratorContext) => void; /** * Registers the Net Event call for {@link eventName} to this method * * * This has internal pretty-printing to make errors easier to track, if * you want to disable this you will need to call {@link DisablePrettyPrint}, or if you're * using esbuild you can add `REMOVE_EVENT_LOG` to your drop label {@link https://esbuild.github.io/api/#drop-labels} * * @param eventName the event to bind this net event to * @param remoteOnly if the event should only accept remote calls, if set to true it will ignore any local call via `emit`, defaults to true */ export declare function NetEvent(eventName: string, remoteOnly?: boolean): (originalMethod: any, context: ClassMethodDecoratorContext) => void; export type NuiCallback = (data: string) => void; /** * Registers the NUI Event call for {eventName} to this method, the function signature * will always be (data: unknown, cb: (data?: any) => void) => void * * There's two valid ways to return data into a callback, returning in the method * you're currently using will automatically call the callback, or you can manually call the callback yourself * * @param eventName the event this will listen for * @param dontErrorWhenCbIsntInvoked this will just block the event fro merroring when the callback is never invoked. */ export declare function NuiEvent(eventName: string, dontErrorWhenCbIsntInvoked?: boolean): (originalMethod: any, context: ClassMethodDecoratorContext) => void;