@orca-fe/hooks
Version:
React Hooks Collections
28 lines (27 loc) • 814 B
TypeScript
import type { HotkeyDefsType } from './hotkey-manager/utils';
/**
* 快捷键对象
*/
export type HotkeyActionType = {
hotkeyName: string;
action: (event: KeyboardEvent) => void | boolean;
target?: () => HTMLElement | undefined | null;
input?: boolean;
through?: boolean;
priority?: number;
disabled?: boolean;
};
/**
* 热键库
*/
export declare const defaultHotkeyDef: HotkeyDefsType;
export declare const actionStack: HotkeyActionType[];
declare const useHotkeyListener: {
(_hotkeyName: string | [string, string], action: HotkeyActionType['action'], options?: Omit<HotkeyActionType, 'hotkeyName' | 'action'>): void;
/**
* 更新预设快捷键
* @param hotkeys
*/
updateHotkeyDefs(hotkeys: HotkeyDefsType): void;
};
export default useHotkeyListener;