/** * 键盘帮助类 */ declare class KeyboardUtility { events: Object; /** * 注册事件 */ add: (element: any, cb: Function, condition: Function, key: string, prevent: boolean, type: string) => void; /** * 移除事件 */ remove: (element: any, key: string, type: string) => void; /** * 监听键盘按下事件 */ keydown: (element: any, cb: Function, condition: Function, key: string, prevent?: boolean) => void; /** * 移除键盘按下事件 */ removeKeydown: (element: any, key: string) => void; /** * 当触发保存时执行 * 想在div上绑定ctrlS事件,需要div处于focus状态,才可以触发已绑定的ctrlS事件 * div设置tabindex=-1,才可以手动触发焦点 */ ctrlS: (element: any, cb: Function) => void; /** * 移除保存事件 */ removeCtrlS: (element: any) => void; /** * 触发Ctrl回车事件 */ ctrlEnter: (element: any, cb: Function) => void; /** * 移除Ctrl回车事件 */ removeCtrlEnter: (element: any) => void; lastKeyTime: number; isKeyLastUp: boolean; /** * 双击事件 */ doubleKey: (element: any, cb: Function, key: string, prevent?: boolean) => void; /** * 移除双击事件 */ removeDoubleKey: (element: any, key: string) => void; /** * 监听键盘抬起事件 */ keyup: (element: any, cb: Function, condition: Function, key: string, prevent?: boolean) => void; /** * 移除键盘抬起事件 */ removeKeyup: (element: any, key: string) => void; /** * 监控是否按下Ctrl */ isCtrl: boolean; ctrl: (document: any) => void; /** * 删除Ctrl事件 */ removeCtrl: (document: any) => void; timer: number; touchStart: Function; touchEnd(): void; touch: (element: any, cb: Function) => void; removeTouch: (element: any) => void; } export default KeyboardUtility;