@turbox3d/event-manager
Version:
Large-scale productivity application event management library
33 lines (32 loc) • 804 B
TypeScript
import { Handler, HotKeyConfig, HotKeyData, Key } from './type';
/**
* 快捷键系统
*/
declare class HotKeyController {
/** 键盘事件监听器 */
private listener;
private keyMap;
constructor();
/**
* 添加快捷键
*
* 快捷键冲突会给 Warn 并添加失败
*/
on(config: HotKeyConfig): this;
/**
* 移除快捷键
*/
off(key: Key, handler: Handler): this;
/**
* 获取展示热键列表(仅返回 show 字段设置为 true 的数据)
*
* 该接口设计用来给展示快捷键的地方用
*/
getHotKeyData(): HotKeyData[];
/**
* 触发快捷键回调
*/
private handler;
}
declare const HotKey: HotKeyController;
export { HotKey, HotKeyController, HotKeyConfig, HotKeyData };