types docs
This commit is contained in:
parent
234bcecc7b
commit
bad4d532f6
@ -12,34 +12,76 @@ export type {
|
||||
RageFW_ICustomClientEvent,
|
||||
} from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available cef event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_CefEvent = keyof RageFW_ICustomCefEvent
|
||||
|
||||
/**
|
||||
* Union of all available server event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ServerEvent = keyof RageFW_ICustomServerEvent
|
||||
|
||||
/**
|
||||
* Union of all available client event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
|
||||
|
||||
/**
|
||||
* Array of arguments of an event you pass as a generic
|
||||
* These only include custom cef events
|
||||
*/
|
||||
export type RageFW_CefArguments<K extends RageFW_CefEvent> = Parameters<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Return type of event you pass as a generic
|
||||
* These only include custom cef events
|
||||
*/
|
||||
export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Callback (function) of event you pass as a generic
|
||||
* These only include custom cef events
|
||||
*/
|
||||
export type RageFW_CefCallback<K extends keyof RageFW_ICustomCefEvent> = (
|
||||
args: RageFW_CefArguments<K>,
|
||||
) => RageFW_CefReturn<K>
|
||||
|
||||
/**
|
||||
* Array of arguments of event you pass as a generic
|
||||
* These only include custom server events
|
||||
*/
|
||||
export type RageFW_ServerArguments<K extends RageFW_ServerEvent> = Parameters<
|
||||
RageFW_ICustomServerEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Return type of event you pass as a generic
|
||||
* These only include custom server events
|
||||
*/
|
||||
export type RageFW_ServerReturn<K extends RageFW_ServerEvent> = ReturnType<
|
||||
RageFW_ICustomServerEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Array of arguments of event you pass as a generic
|
||||
* These only include custom client events
|
||||
*/
|
||||
export type RageFW_ClientArguments<K extends RageFW_ClientEvent> = Parameters<
|
||||
RageFW_ICustomClientEvent[K]
|
||||
>
|
||||
|
||||
/**
|
||||
* Return type of event you pass as a generic
|
||||
* These only include custom client events
|
||||
*/
|
||||
export type RageFW_ClientReturn<K extends RageFW_ClientEvent> = ReturnType<
|
||||
RageFW_ICustomClientEvent[K]
|
||||
>
|
||||
|
@ -2,15 +2,31 @@
|
||||
|
||||
import type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available client event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEventArguments<K extends RageFW_ClientEvent> =
|
||||
Parameters<RageFW_ICustomClientEvent[K]>
|
||||
|
||||
/**
|
||||
* Callback (function) for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEventCallback<K extends RageFW_ClientEvent> = (
|
||||
args: RageFW_ClientEventArguments<K>,
|
||||
) => RageFW_ClientEventReturn<K>
|
||||
|
||||
/**
|
||||
* Return type for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEventReturn<K extends RageFW_ClientEvent> =
|
||||
K extends keyof RageFW_ICustomClientEvent
|
||||
? ReturnType<RageFW_ICustomClientEvent[K]>
|
||||
|
@ -2,14 +2,26 @@
|
||||
|
||||
import type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available server event names callable from client
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientServerEvent = keyof RageFW_ICustomServerEvent
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientServerEventArguments<
|
||||
K extends RageFW_ClientServerEvent,
|
||||
> = K extends keyof RageFW_ICustomServerEvent
|
||||
? Parameters<RageFW_ICustomServerEvent[K]>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Return type for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientServerEventReturn<K extends RageFW_ClientServerEvent> =
|
||||
K extends keyof RageFW_ICustomServerEvent
|
||||
? ReturnType<RageFW_ICustomServerEvent[K]>
|
||||
|
@ -2,13 +2,25 @@
|
||||
|
||||
import type { RageFW_ICustomClientEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available client event names
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
|
||||
|
||||
/**
|
||||
* Array of arguments of an event you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEventArguments<K extends RageFW_ClientEvent> =
|
||||
K extends RageFW_ClientEvent
|
||||
? Parameters<RageFW_ICustomClientEvent[K]>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Return type of event you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ClientEventReturn<K extends RageFW_ClientEvent> =
|
||||
K extends RageFW_ClientEvent
|
||||
? ReturnType<RageFW_ICustomClientEvent[K]>
|
||||
|
@ -3,10 +3,18 @@
|
||||
import type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
|
||||
export type { RageFW_ICustomServerEvent } from 'rage-fw-shared-types'
|
||||
|
||||
/**
|
||||
* Union of all available server event names
|
||||
* These also include system events
|
||||
*/
|
||||
export type RageFW_ServerEvent =
|
||||
| keyof RageFW_ICustomServerEvent
|
||||
| keyof IServerEvents
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These also include system events
|
||||
*/
|
||||
export type RageFW_ServerEventArguments<K extends RageFW_ServerEvent> =
|
||||
K extends keyof RageFW_ICustomServerEvent
|
||||
? Parameters<RageFW_ServerEventCallbackCustom<K>>
|
||||
@ -14,6 +22,10 @@ export type RageFW_ServerEventArguments<K extends RageFW_ServerEvent> =
|
||||
? Parameters<RageFW_ServerEventCallbackNative<K>>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Callback (function) for an event, name of which you pass as a generic
|
||||
* These include system and custom events
|
||||
*/
|
||||
export type RageFW_ServerEventCallback<K extends RageFW_ServerEvent> =
|
||||
K extends keyof RageFW_ICustomServerEvent
|
||||
? RageFW_ServerEventCallbackCustom<K>
|
||||
@ -21,6 +33,10 @@ export type RageFW_ServerEventCallback<K extends RageFW_ServerEvent> =
|
||||
? RageFW_ServerEventCallbackNative<K>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Return type for an event, name of which you pass as a generic
|
||||
* These include system and custom events
|
||||
*/
|
||||
export type RageFW_ServerEventReturn<K extends RageFW_ServerEvent> =
|
||||
K extends keyof RageFW_ICustomServerEvent
|
||||
? ReturnType<RageFW_ICustomServerEvent[K]>
|
||||
@ -28,6 +44,10 @@ export type RageFW_ServerEventReturn<K extends RageFW_ServerEvent> =
|
||||
? ReturnType<IServerEvents[K]>
|
||||
: never
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These only include custom events
|
||||
*/
|
||||
export type RageFW_ServerEventCallbackCustom<
|
||||
K extends keyof RageFW_ICustomServerEvent = keyof RageFW_ICustomServerEvent,
|
||||
> = (
|
||||
@ -35,6 +55,10 @@ export type RageFW_ServerEventCallbackCustom<
|
||||
args: RageFW_ServerEventArguments<K>,
|
||||
) => RageFW_ServerEventReturn<K>
|
||||
|
||||
/**
|
||||
* Array of arguments for an event, name of which you pass as a generic
|
||||
* These only include system events
|
||||
*/
|
||||
export type RageFW_ServerEventCallbackNative<
|
||||
K extends keyof IServerEvents = keyof IServerEvents,
|
||||
> = IServerEvents[K]
|
||||
|
Loading…
Reference in New Issue
Block a user