Comparing version 0.1.0 to 0.1.1
@@ -103,2 +103,10 @@ 'use strict'; | ||
function isCodeHotkey(hotkey, event) { | ||
return isHotkey(hotkey, event); | ||
} | ||
function isKeyHotkey(hotkey, event) { | ||
return isHotkey(hotkey, { byKey: true }, event); | ||
} | ||
/** | ||
@@ -217,2 +225,4 @@ * Parse. | ||
exports.isHotkey = isHotkey; | ||
exports.isCodeHotkey = isCodeHotkey; | ||
exports.isKeyHotkey = isKeyHotkey; | ||
exports.parseHotkey = parseHotkey; | ||
@@ -219,0 +229,0 @@ exports.compareHotkey = compareHotkey; |
{ | ||
"name": "is-hotkey", | ||
"description": "Check whether a browser event matches a hotkey.", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/ianstormtaylor/is-hotkey.git", |
@@ -88,4 +88,17 @@ | ||
```js | ||
import isHotkey from 'is-hotkey' | ||
import { isCodeHotkey, isKeyHotkey } from 'is-hotkey' | ||
isHotkey('mod+s')(event) | ||
isHotkey('mod+s', { byKey: true })(event) | ||
isCodeHotkey('mod+s', event) | ||
isKeyHotkey('mod+s', event) | ||
``` | ||
By default the hotkey string is checked using `event.which`. But you can also pass in `byKey: true` to compare using the [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) API, which stays the same regardless of keyboard layout. | ||
Or to reduce the noise if you are defining lots of hotkeys, you can use the `isCodeHotkey` and `isKeyHotkey` helpers that are exported. | ||
```js | ||
@@ -92,0 +105,0 @@ import { toKeyName, toKeyCode } from 'is-hotkey' |
@@ -101,2 +101,10 @@ | ||
function isCodeHotkey(hotkey, event) { | ||
return isHotkey(hotkey, event) | ||
} | ||
function isKeyHotkey(hotkey, event) { | ||
return isHotkey(hotkey, { byKey: true }, event) | ||
} | ||
/** | ||
@@ -195,2 +203,4 @@ * Parse. | ||
isHotkey, | ||
isCodeHotkey, | ||
isKeyHotkey, | ||
parseHotkey, | ||
@@ -197,0 +207,0 @@ compareHotkey, |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
116746
367
129
0