fix core
- renaming done
This commit is contained in:
parent
d9b917c024
commit
d8df9fa7ef
@ -35,19 +35,19 @@ export class Player {
|
|||||||
>(eventName, args)
|
>(eventName, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async triggerBrowser<EventName extends T.RageFW_CefEvent>(
|
public async triggerBrowser<EventName extends T.RageFW_BrowserEvent>(
|
||||||
eventName: EventName,
|
eventName: EventName,
|
||||||
...args: T._CefEventHasArgs<EventName> extends true
|
...args: T._BrowserEventHasArgs<EventName> extends true
|
||||||
? [T.RageFW_CefArgs<EventName>]
|
? [T.RageFW_BrowserArgs<EventName>]
|
||||||
: []
|
: []
|
||||||
): Promise<T.RageFW_CefReturn<EventName>> {
|
): Promise<T.RageFW_BrowserReturn<EventName>> {
|
||||||
if (!this._browser)
|
if (!this._browser)
|
||||||
throw new Error('You need to initialize browser first')
|
throw new Error('You need to initialize browser first')
|
||||||
|
|
||||||
return await rpc.callBrowser<
|
return await rpc.callBrowser<
|
||||||
typeof args,
|
typeof args,
|
||||||
EventName,
|
EventName,
|
||||||
T.RageFW_CefReturn<EventName>
|
T.RageFW_BrowserReturn<EventName>
|
||||||
>(eventName, args)
|
>(eventName, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,21 +6,21 @@ import type { RageFW_ICustomBrowserEvent } from '@entityseven/rage-fw-shared-typ
|
|||||||
* Union of all available browser event names callable from client
|
* Union of all available browser event names callable from client
|
||||||
* These only include custom events
|
* These only include custom events
|
||||||
*/
|
*/
|
||||||
export type RageFW_CefEvent = keyof RageFW_ICustomBrowserEvent
|
export type RageFW_BrowserEvent = keyof RageFW_ICustomBrowserEvent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
* These only include custom events
|
* These only include custom events
|
||||||
*/
|
*/
|
||||||
export type RageFW_CefArgs<K extends RageFW_CefEvent> = Parameters<
|
export type RageFW_BrowserArgs<K extends RageFW_BrowserEvent> = Parameters<
|
||||||
RageFW_ICustomBrowserEvent[K]
|
RageFW_ICustomBrowserEvent[K]
|
||||||
>
|
>
|
||||||
|
|
||||||
export type RageFW_CefReturn<K extends RageFW_CefEvent> = ReturnType<
|
export type RageFW_BrowserReturn<K extends RageFW_BrowserEvent> = ReturnType<
|
||||||
RageFW_ICustomBrowserEvent[K]
|
RageFW_ICustomBrowserEvent[K]
|
||||||
>
|
>
|
||||||
|
|
||||||
export type _CefEventHasArgs<
|
export type _BrowserEventHasArgs<
|
||||||
EventName extends keyof RageFW_ICustomBrowserEvent,
|
EventName extends keyof RageFW_ICustomBrowserEvent,
|
||||||
> = keyof RageFW_ICustomBrowserEvent extends never
|
> = keyof RageFW_ICustomBrowserEvent extends never
|
||||||
? false
|
? false
|
||||||
|
@ -15,7 +15,7 @@ export class Player {
|
|||||||
public async triggerBrowser<EventName extends T.RageFW_BrowserEvent>(
|
public async triggerBrowser<EventName extends T.RageFW_BrowserEvent>(
|
||||||
player: PlayerMp,
|
player: PlayerMp,
|
||||||
eventName: EventName,
|
eventName: EventName,
|
||||||
...args: T._CefEventHasArgs<EventName> extends true
|
...args: T._BrowserEventHasArgs<EventName> extends true
|
||||||
? [T.RageFW_BrowserArgs<EventName>]
|
? [T.RageFW_BrowserArgs<EventName>]
|
||||||
: []
|
: []
|
||||||
): Promise<T.RageFW_BrowserReturn<EventName>> {
|
): Promise<T.RageFW_BrowserReturn<EventName>> {
|
||||||
|
@ -25,7 +25,7 @@ export type RageFW_BrowserReturn<K extends RageFW_BrowserEvent> = ReturnType<
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export type _CefEventHasArgs<
|
export type _BrowserEventHasArgs<
|
||||||
EventName extends keyof RageFW_ICustomBrowserEvent,
|
EventName extends keyof RageFW_ICustomBrowserEvent,
|
||||||
> = keyof RageFW_ICustomBrowserEvent extends never
|
> = keyof RageFW_ICustomBrowserEvent extends never
|
||||||
? false
|
? false
|
||||||
|
Loading…
Reference in New Issue
Block a user