react-keybindings
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "react-keybindings", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Add keybindings in React apps", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -13,10 +13,16 @@ # React Keybindings | ||
## Usage | ||
## Usage of `mapActionsToKeys(keymap)` | ||
React Keybindings provides a `mapActionsToKeys` higher-order component to wrap an existing component. It allows you to map actions to shortcuts and get the triggered actions in props. | ||
React Keybindings provides a higher-order component to wrap an existing component. It allows you to map actions to shortcuts. Then you are able to know which actions have been triggered and which keys have been pressed. | ||
You can write shortcuts as strings (e.g. `"ctrl+shift+s"`) or as arrays of key codes (e.g. `[17, 65]`). | ||
### Arguments | ||
Example: | ||
* `keymap` (_Object_): this is an object which map actions to shortcuts. You can write shortcuts as strings (e.g. `"ctrl+shift+s"`) or as arrays of key codes (e.g. `[17, 65]`). | ||
### Returns | ||
It returns a React component class that injects `pressedKeys` and `keyActions` into your component. | ||
## Example | ||
```js | ||
@@ -23,0 +29,0 @@ import React from "react" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19340
67