mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
feat(package): interface definitions
This commit is contained in:
36
package/client/resource/interface/context.ts
Normal file
36
package/client/resource/interface/context.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { IconName, IconPrefix } from '@fortawesome/fontawesome-common-types';
|
||||
|
||||
interface ContextMenuItem {
|
||||
menu?: string;
|
||||
icon?: IconName | [IconPrefix, IconName];
|
||||
iconColor?: string;
|
||||
onSelect?: () => void;
|
||||
arrow?: boolean;
|
||||
description?: boolean;
|
||||
metadata?: string | { [key: string]: any } | string[];
|
||||
event?: string;
|
||||
serverEvent?: string;
|
||||
args?: any;
|
||||
}
|
||||
|
||||
interface ContextMenuArrayItem extends ContextMenuItem {
|
||||
title: string;
|
||||
}
|
||||
|
||||
interface ContextMenuProps {
|
||||
id: string;
|
||||
title: string;
|
||||
menu?: string;
|
||||
onExit?: () => void;
|
||||
canClose?: boolean;
|
||||
options: { [key: string]: ContextMenuItem } | ContextMenuArrayItem[];
|
||||
}
|
||||
|
||||
type registerContext = (context: ContextMenuProps) => void;
|
||||
export const registerContext: registerContext = (context) => exports.ox_lib.registerContext(context);
|
||||
|
||||
export const showContext = (id: string): void => exports.ox_lib.showContext(id);
|
||||
|
||||
export const hideContext = (onExit: boolean): void => exports.ox_lib.hideContext(onExit);
|
||||
|
||||
export const getOpenContextMenu = (): string | null => exports.ox_lib.getOpenContextMenu();
|
||||
Reference in New Issue
Block a user