client receive destructurized args

This commit is contained in:
Oleksandr Honcharov 2024-06-10 23:38:51 +03:00
parent aed9bf2091
commit 44602be670
2 changed files with 4 additions and 2 deletions

View File

@ -12,7 +12,9 @@ class Client {
eventName: EventName, eventName: EventName,
callback: RageFW_ClientServerCallback<EventName>, callback: RageFW_ClientServerCallback<EventName>,
): void { ): void {
rpc.register(eventName, callback as rpc.ProcedureListener) rpc.register(eventName, data => {
return callback(...data)
})
} }
} }

View File

@ -20,5 +20,5 @@ export type RageFW_ClientEventReturn<K extends RageFW_ClientEvent> =
export type RageFW_ClientServerEvent = keyof RageFW_ICustomClientEvent export type RageFW_ClientServerEvent = keyof RageFW_ICustomClientEvent
export type RageFW_ClientServerCallback<K extends RageFW_ClientServerEvent> = ( export type RageFW_ClientServerCallback<K extends RageFW_ClientServerEvent> = (
args: Parameters<RageFW_ICustomClientEvent[K]>, ...args: Parameters<RageFW_ICustomClientEvent[K]>
) => ReturnType<RageFW_ICustomClientEvent[K]> ) => ReturnType<RageFW_ICustomClientEvent[K]>