From 9636ae9d5edb445644c2eb0b47769346d19fbb41 Mon Sep 17 00:00:00 2001 From: Josh Olson Date: Tue, 5 Apr 2016 15:49:31 -0500 Subject: [PATCH] Fix definitions of #bind/#unbind, merge overloads See https://github.com/RobertWHurst/KeyboardJS/blob/master/lib/keyboard.js#L54 for bind() See https://github.com/RobertWHurst/KeyboardJS/blob/master/lib/keyboard.js#L84 for unbind() --- keyboardjs/keyboardjs.d.ts | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/keyboardjs/keyboardjs.d.ts b/keyboardjs/keyboardjs.d.ts index eb7129996b..e4247234ea 100644 --- a/keyboardjs/keyboardjs.d.ts +++ b/keyboardjs/keyboardjs.d.ts @@ -39,21 +39,17 @@ declare namespace keyboardjs { * @param keyCombo String of keys to be pressed to execute callbacks. * @param pressed Callback that gets executed when the keyComboState is 'pressed', can be null. * @param released Callback that gets executed when the keyComboState is 'released' + * @param preventRepeatByDefault Whether or not to prevent repeat by default. Defaults to false. */ - export function bind(keyCombo: string, pressed: Callback, released: Callback): void; - /** - * Binds a keyCombo to specific callback functions. - * @param keyCombo String of keys to be pressed to execute callbacks. - * @param pressed Callback that gets executed when the keyComboState is 'pressed' - */ - export function bind(keyCombo: string, pressed: Callback): void; - + export function bind(keyCombo: string | string[], pressed: Callback, released?: Callback, preventRepeatByDefault?: boolean): void; /** - * Unbinds a keyCombo + * Unbinds a keyCombo completely or only specific pressed & released callback combos. * @param keyCombo String of keys to be pressed to execute callbacks. + * @param pressed Callback that gets executed when the keyComboState is 'pressed', can be null. + * @param released Callback that gets executed when the keyComboState is 'released', can be null. */ - export function unbind(keyCombo: string): void; + export function unbind(keyCombo: string | string[], pressed?: Callback, released?: Callback): void; // ---------- Context ---------- //