Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Oleksandr Honcharov 2024-09-15 21:32:32 +03:00
commit b1adb809f8
5 changed files with 9 additions and 7 deletions

View File

@ -30,7 +30,7 @@ export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
*/
export type RageFW_CefCallback<K extends keyof RageFW_ICustomCefEvent> = (
args: RageFW_CefArgs<K>,
) => RageFW_CefReturn<K>
) => Promise<RageFW_CefReturn<K>>
export type _CefEventHasArgs<EventName extends keyof RageFW_ICustomCefEvent> =
keyof RageFW_ICustomCefEvent extends never

View File

@ -7,8 +7,8 @@ export class Client {
eventName: EventName,
callback: RageFW_ClientCallback<EventName>,
): void {
rpc.register(eventName, data => {
return callback(data)
rpc.register(eventName, async data => {
return await callback(data)
})
}

View File

@ -27,7 +27,7 @@ export type RageFW_ClientArgs<K extends RageFW_ClientEvent> =
*/
export type RageFW_ClientCallback<K extends RageFW_ClientEvent> = (
args: RageFW_ClientArgs<K>,
) => RageFW_ClientReturn<K>
) => Promise<RageFW_ClientReturn<K>>
/**
* Return type for an event, name of which you pass as a generic

View File

@ -24,7 +24,7 @@ export class Server {
rpc.register(
eventName,
async (args: RageFW_ServerArgs<EventName>, info) => {
callback([info.player as PlayerMp, ...args])
await callback([info.player as PlayerMp, ...args])
},
)
}

View File

@ -55,7 +55,7 @@ export type RageFW_ServerCallbackCustom<
K extends keyof RageFW_ICustomServerEvent = keyof RageFW_ICustomServerEvent,
> = (
payload: [player: PlayerMp, ...args: RageFW_ServerArgs<K>],
) => RageFW_ServerReturn<K>
) => Promise<RageFW_ServerReturn<K>>
/**
* Array of arguments for an event, name of which you pass as a generic
@ -63,7 +63,9 @@ export type RageFW_ServerCallbackCustom<
*/
export type RageFW_ServerCallbackNative<
K extends keyof IServerEvents = keyof IServerEvents,
> = (payload: Parameters<IServerEvents[K]>) => ReturnType<IServerEvents[K]>
> = (
payload: Parameters<IServerEvents[K]>,
) => Promise<ReturnType<IServerEvents[K]>>
export type _ServerEventHasArgs<EventName extends RageFW_ServerEvent> =
EventName extends keyof RageFW_ICustomServerEvent