cef functionality implementation
This commit is contained in:
parent
fa3b1b1b0b
commit
88e40a4635
@ -1,13 +1,46 @@
|
||||
import rpc from 'rage-rpc'
|
||||
|
||||
import {
|
||||
RageFW_CefArguments,
|
||||
RageFW_CefCallback,
|
||||
RageFW_CefReturn,
|
||||
RageFW_ClientArguments,
|
||||
RageFW_ClientReturn,
|
||||
RageFW_ServerArguments,
|
||||
RageFW_ServerReturn,
|
||||
RageFW_ICustomCefEvent,
|
||||
RageFW_ICustomClientEvent,
|
||||
RageFW_ICustomServerEvent,
|
||||
} from './types'
|
||||
|
||||
class Cef {
|
||||
public register() {}
|
||||
public register<EventName extends keyof RageFW_ICustomCefEvent>(
|
||||
eventName: EventName,
|
||||
callback: RageFW_CefCallback<EventName>,
|
||||
): void {
|
||||
rpc.register(eventName, callback)
|
||||
}
|
||||
|
||||
public trigger() {}
|
||||
public trigger<EventName extends keyof RageFW_ICustomCefEvent>(
|
||||
eventName: EventName,
|
||||
args: RageFW_CefArguments<EventName>,
|
||||
): Promise<RageFW_CefReturn<EventName>> {
|
||||
return rpc.call(eventName, args)
|
||||
}
|
||||
|
||||
public triggerServer() {}
|
||||
public triggerServer<EventName extends keyof RageFW_ICustomServerEvent>(
|
||||
eventName: EventName,
|
||||
args: RageFW_ServerArguments<EventName>,
|
||||
): Promise<RageFW_ServerReturn<EventName>> {
|
||||
return rpc.callServer(eventName, args)
|
||||
}
|
||||
|
||||
public triggerClient() {}
|
||||
public triggerClient<EventName extends keyof RageFW_ICustomClientEvent>(
|
||||
eventName: EventName,
|
||||
args: RageFW_ClientArguments<EventName>,
|
||||
): Promise<RageFW_ClientReturn<EventName>> {
|
||||
return rpc.callClient(eventName, args)
|
||||
}
|
||||
}
|
||||
|
||||
export const fw = {
|
||||
|
@ -0,0 +1,45 @@
|
||||
/// <reference types="@ragempcommunity/types-cef" />
|
||||
|
||||
import type {
|
||||
RageFW_ICustomCefEvent,
|
||||
RageFW_ICustomClientEvent,
|
||||
RageFW_ICustomServerEvent,
|
||||
} from 'rage-fw-shared-types'
|
||||
|
||||
export type {
|
||||
RageFW_ICustomCefEvent,
|
||||
RageFW_ICustomServerEvent,
|
||||
RageFW_ICustomClientEvent,
|
||||
} from 'rage-fw-shared-types'
|
||||
|
||||
export type RageFW_CefEvent = keyof RageFW_ICustomCefEvent
|
||||
export type RageFW_ServerEvent = keyof RageFW_ICustomServerEvent
|
||||
export type RageFW_ClientEvent = keyof RageFW_ICustomClientEvent
|
||||
|
||||
export type RageFW_CefArguments<K extends RageFW_CefEvent> = Parameters<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
|
||||
RageFW_ICustomCefEvent[K]
|
||||
>
|
||||
|
||||
export type RageFW_CefCallback<K extends keyof RageFW_ICustomCefEvent> = (
|
||||
args: RageFW_CefArguments<K>,
|
||||
) => RageFW_CefReturn<K>
|
||||
|
||||
export type RageFW_ServerArguments<K extends RageFW_ServerEvent> = Parameters<
|
||||
RageFW_ICustomServerEvent[K]
|
||||
>
|
||||
|
||||
export type RageFW_ServerReturn<K extends RageFW_ServerEvent> = ReturnType<
|
||||
RageFW_ICustomServerEvent[K]
|
||||
>
|
||||
|
||||
export type RageFW_ClientArguments<K extends RageFW_ClientEvent> = Parameters<
|
||||
RageFW_ICustomClientEvent[K]
|
||||
>
|
||||
|
||||
export type RageFW_ClientReturn<K extends RageFW_ClientEvent> = ReturnType<
|
||||
RageFW_ICustomClientEvent[K]
|
||||
>
|
@ -12,7 +12,7 @@
|
||||
"moduleDetection": "auto",
|
||||
"module": "CommonJS",
|
||||
"resolveJsonModule": true,
|
||||
"declaration": true,
|
||||
"declaration": false,
|
||||
"declarationMap": false,
|
||||
"sourceMap": false,
|
||||
"downlevelIteration": false,
|
||||
|
Loading…
Reference in New Issue
Block a user