import { OnDestroy } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import { ShortcutEventOutput, ShortcutInput } from './types'; export declare class ShortcutsService implements OnDestroy { /** * 解析快捷键 * 并为每个KEY 创建一个函数 */ private _shortcuts; /** * 控制按键时间. */ private throttleTime; private _pressed; /** * Streams of pressed events, can be used instead or with a command. */ pressed$: Observable; /** * 禁用快捷键 */ private disabled; private _ignored; /** * Subscription for on destroy. */ private readonly subscription; private keydown$; private isAllowed; private mapEvent; private readonly shortcuts; constructor(); /** * Remove subscription. */ ngOnDestroy(): void; /** * Enable all keyboard shortcuts */ enable(): ShortcutsService; /** * Disable all keyboard shortcuts */ disable(): ShortcutsService; /** * Check if all keyboard shortcuts are disabled. */ isDisabled(): boolean; /** * Add new shortcut/s */ add(shortcuts: ShortcutInput[] | ShortcutInput, instance?: any): ShortcutsService; /** * bind to the component ngOnDestroy to remove related keys * when component is destroyed. * @param instance - component to remove keys when ngOnDestroy is called. * @param keys */ private bindOnDestroy(instance, keys); /** * Remove a command based on key or array of keys. * can be used for cleanup. * @param key * @returns */ remove(key: string | string[]): ShortcutsService; /** * Returns an observable of keyboard shortcut filtered by a specific key. * @param key - the key to filter the observable by. */ select(key: string): Observable; /** * transforms a shortcut to: * a predicate function */ private getKeys; /** * Parse each command using getKeys function */ private parseCommand(command); }