fix: microchanges
This commit is contained in:
parent
1467bb65b0
commit
70df94afa2
@ -30,7 +30,7 @@ export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
|
|||||||
*/
|
*/
|
||||||
export type RageFW_CefCallback<K extends keyof RageFW_ICustomCefEvent> = (
|
export type RageFW_CefCallback<K extends keyof RageFW_ICustomCefEvent> = (
|
||||||
args: RageFW_CefArgs<K>,
|
args: RageFW_CefArgs<K>,
|
||||||
) => RageFW_CefReturn<K>
|
) => Promise<RageFW_CefReturn<K>>
|
||||||
|
|
||||||
export type _CefEventHasArgs<EventName extends keyof RageFW_ICustomCefEvent> =
|
export type _CefEventHasArgs<EventName extends keyof RageFW_ICustomCefEvent> =
|
||||||
keyof RageFW_ICustomCefEvent extends never
|
keyof RageFW_ICustomCefEvent extends never
|
||||||
|
@ -7,8 +7,8 @@ export class Client {
|
|||||||
eventName: EventName,
|
eventName: EventName,
|
||||||
callback: RageFW_ClientCallback<EventName>,
|
callback: RageFW_ClientCallback<EventName>,
|
||||||
): void {
|
): void {
|
||||||
rpc.register(eventName, data => {
|
rpc.register(eventName, async data => {
|
||||||
return callback(data)
|
return await callback(data)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export type RageFW_ClientArgs<K extends RageFW_ClientEvent> =
|
|||||||
*/
|
*/
|
||||||
export type RageFW_ClientCallback<K extends RageFW_ClientEvent> = (
|
export type RageFW_ClientCallback<K extends RageFW_ClientEvent> = (
|
||||||
args: RageFW_ClientArgs<K>,
|
args: RageFW_ClientArgs<K>,
|
||||||
) => RageFW_ClientReturn<K>
|
) => Promise<RageFW_ClientReturn<K>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return type for an event, name of which you pass as a generic
|
* Return type for an event, name of which you pass as a generic
|
||||||
|
@ -24,7 +24,7 @@ export class Server {
|
|||||||
rpc.register(
|
rpc.register(
|
||||||
eventName,
|
eventName,
|
||||||
async (args: RageFW_ServerArgs<EventName>, info) => {
|
async (args: RageFW_ServerArgs<EventName>, info) => {
|
||||||
callback([info.player as PlayerMp, ...args])
|
await callback([info.player as PlayerMp, ...args])
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ export type RageFW_ServerCallbackCustom<
|
|||||||
K extends keyof RageFW_ICustomServerEvent = keyof RageFW_ICustomServerEvent,
|
K extends keyof RageFW_ICustomServerEvent = keyof RageFW_ICustomServerEvent,
|
||||||
> = (
|
> = (
|
||||||
payload: [player: PlayerMp, ...args: RageFW_ServerArgs<K>],
|
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
|
* 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<
|
export type RageFW_ServerCallbackNative<
|
||||||
K extends keyof IServerEvents = keyof IServerEvents,
|
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> =
|
export type _ServerEventHasArgs<EventName extends RageFW_ServerEvent> =
|
||||||
EventName extends keyof RageFW_ICustomServerEvent
|
EventName extends keyof RageFW_ICustomServerEvent
|
||||||
|
Loading…
Reference in New Issue
Block a user