UNPKG

@alilc/lowcode-editor-core

Version:

Core Api for Ali lowCode engine

35 lines (34 loc) 1.25 kB
import { IPublicTypeHotkeyCallback, IPublicTypeHotkeyCallbacks, IPublicApiHotkey, IPublicTypeDisposable } from '@alilc/lowcode-types'; export interface IHotKey extends Hotkey { } export declare class Hotkey implements Omit<IPublicApiHotkey, 'bind' | 'callbacks'> { readonly viewName: string; callBacks: IPublicTypeHotkeyCallbacks; private directMap; private sequenceLevels; private resetTimer; private ignoreNextKeyup; private ignoreNextKeypress; private nextExpectedAction; private isActivate; constructor(viewName?: string); activate(activate: boolean): void; mount(window: Window): IPublicTypeDisposable; bind(combos: string[] | string, callback: IPublicTypeHotkeyCallback, action?: string): Hotkey; unbind(combos: string[] | string, callback: IPublicTypeHotkeyCallback, action?: string): void; /** * resets all sequence counters except for the ones passed in */ private resetSequences; /** * finds all callbacks that match based on the keycode, modifiers, * and action */ private getMatches; private handleKey; private handleKeyEvent; private resetSequenceTimer; private bindSequence; private bindSingle; private bindMultiple; }