diff --git a/readme.md b/readme.md index 8bb66ac..17764b0 100644 --- a/readme.md +++ b/readme.md @@ -33,8 +33,8 @@ import { bindKey, bindKeyCombo } from '@rwh/keystrokes' bindKey('a', () => console.log('You\'re pressing "a"')) -bindKeyCombo('ctrl > y, r', () => - console.log('You pressed "ctrl" then "y", released both, and are pressing "r"')) +bindKeyCombo('control > y, r', () => + console.log('You pressed "control" then "y", released both, and are pressing "r"')) ``` ## Installation @@ -142,8 +142,8 @@ import { bindKey, bindKeyCombo } from '@rwh/keystrokes' bindKey('a', () => console.log('You\'re pressing "a"')) -bindKeyCombo('ctrl > y, r', () => - console.log('You pressed "ctrl" then "y", released both, and are pressing "r"')) +bindKeyCombo('control > y, r', () => + console.log('You pressed "control" then "y", released both, and are pressing "r"')) bindKey('a', { onPressed: () => console.log('You pressed "a"'), @@ -151,9 +151,9 @@ bindKey('a', { onReleased: () => console.log('You released "a"'), }) -bindKeyCombo('ctrl > y, r', { - onPressed: () => console.log('You pressed "ctrl" then "y", released both, then pressed "r"'), - onPressedWithRepeat: () => console.log('You pressed "ctrl" then "y", released both, and are pressing "r"'), +bindKeyCombo('control > y, r', { + onPressed: () => console.log('You pressed "control" then "y", released both, then pressed "r"'), + onPressedWithRepeat: () => console.log('You pressed "control" then "y", released both, and are pressing "r"'), onReleased: () => console.log('You released "r"'), }) ``` @@ -162,11 +162,11 @@ Note that when you pass a function handler instead of an object handler, it is short hand for passing an object handler with a `onPressedWithRepeat` method. ```js -const handler = () => console.log('You pressed "ctrl" then "y", released both, and are pressing "r"') +const handler = () => console.log('You pressed "control" then "y", released both, and are pressing "r"') -bindKeyCombo('ctrl > y, r', handler) +bindKeyCombo('control > y, r', handler) // ...is shorthand for... -bindKeyCombo('ctrl > y, r', { onPressedWithRepeat: handler }) +bindKeyCombo('control > y, r', { onPressedWithRepeat: handler }) ``` ## Unbinding Keys and Key Combos @@ -181,20 +181,20 @@ import { bindKeyCombo, unbindKeyCombo } from '@rwh/keystrokes' const handler = () => ... // bind the combo to the handler -bindKeyCombo('ctrl > y, r', handler) +bindKeyCombo('control > y, r', handler) // ...and some time later... // unbind the handler -unbindKeyCombo('ctrl > y, r', handler) +unbindKeyCombo('control > y, r', handler) ``` You can also wipe out all bound handlers on a combo by excluding a handler reference. ```js -// unbind all handlers for the combo 'ctrl > y, r' -unbindKeyCombo('ctrl > y, r') +// unbind all handlers for the combo 'control > y, r' +unbindKeyCombo('control > y, r') ``` ## Checking Keys and Key Combos @@ -208,9 +208,9 @@ import { checkKey, checkKeyCombo } from '@rwh/keystrokes' // keyIsPressed will be true if a is pressed, and false otherwise const keyIsPressed = checkKey('a') -// keyComboIsPressed will be true if ctrl then y was pressed and r is pressed. +// keyComboIsPressed will be true if control then y was pressed and r is pressed. // It will be false otherwise. -const keyComboIsPressed = checkKeyCombo('ctrl > y, r') +const keyComboIsPressed = checkKeyCombo('control > y, r') ``` ## Using Keystrokes with React