type: fix eslint warnings.

pull/268/head
jaywcjlove 4 years ago
parent 458aa2ac34
commit 45d4f54dd0

78
index.d.ts vendored

@ -1,53 +1,53 @@
export interface HotkeysEvent { export interface HotkeysEvent {
key: string key: string;
method: KeyHandler method: KeyHandler;
mods: number[] mods: number[];
scope: string scope: string;
shortcut: string shortcut: string;
} }
export interface KeyHandler { export interface KeyHandler {
(keyboardEvent: KeyboardEvent, hotkeysEvent: HotkeysEvent): void | boolean (keyboardEvent: KeyboardEvent, hotkeysEvent: HotkeysEvent): void | boolean;
} }
type Options = { type Options = {
scope?: string, scope?: string;
element?: HTMLElement | null, element?: HTMLElement | null;
keyup?: boolean | null keyup?: boolean | null;
keydown?: boolean | null keydown?: boolean | null;
splitKey?: string; splitKey?: string;
} }
interface Hotkeys { interface Hotkeys {
(key: string, method: KeyHandler): void (key: string, method: KeyHandler): void;
(key: string, scope: string, method: KeyHandler): void (key: string, scope: string, method: KeyHandler): void;
(key: string, options: Options, method: KeyHandler): void (key: string, options: Options, method: KeyHandler): void;
shift: boolean shift: boolean;
ctrl: boolean ctrl: boolean;
alt: boolean alt: boolean;
option: boolean option: boolean;
control: boolean control: boolean;
cmd: boolean cmd: boolean;
command: boolean command: boolean;
setScope(scopeName: string): void setScope(scopeName: string): void;
getScope(): string getScope(): string;
deleteScope(scopeName: string): void deleteScope(scopeName: string): void;
noConflict(): Hotkeys noConflict(): Hotkeys;
unbind(key?: string): void unbind(key?: string): void;
unbind(key: string, scopeName: string): void unbind(key: string, scopeName: string): void;
unbind(key: string, scopeName: string, method: KeyHandler): void unbind(key: string, scopeName: string, method: KeyHandler): void;
unbind(key: string, method: KeyHandler): void unbind(key: string, method: KeyHandler): void;
isPressed(keyCode: number): boolean isPressed(keyCode: number): boolean;
isPressed(keyCode: string): boolean isPressed(keyCode: string): boolean;
getPressedKeyCodes(): number[] getPressedKeyCodes(): number[];
filter(event: KeyboardEvent): boolean filter(event: KeyboardEvent): boolean;
} }
// https://github.com/eiriklv/react-masonry-component/issues/57 // https://github.com/eiriklv/react-masonry-component/issues/57
declare var hotkeys: Hotkeys declare var hotkeys: Hotkeys;
export default hotkeys; export default hotkeys;

Loading…
Cancel
Save