Skip to content

Commit c2af3f3

Browse files
committed
chore: build code.
1 parent aae0b87 commit c2af3f3

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

dist/hotkeys.common.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ const elementEventMap = new Map();
179179

180180
/** Return key code */
181181
const code = x => _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
182+
const getKey = x => Object.keys(_keyMap).find(k => _keyMap[k] === x);
183+
const getModifier = x => Object.keys(_modifier).find(k => _modifier[k] === x);
182184

183185
/** Set or get the current scope (defaults to 'all') */
184186
function setScope(scope) {
@@ -192,6 +194,9 @@ function getScope() {
192194
function getPressedKeyCodes() {
193195
return _downKeys.slice(0);
194196
}
197+
function getPressedKeyString() {
198+
return _downKeys.map(c => getKey(c) || getModifier(c) || String.fromCharCode(c));
199+
}
195200
function getAllKeyCodes() {
196201
const result = [];
197202
Object.keys(_handlers).forEach(k => {
@@ -524,7 +529,8 @@ function hotkeys(key, option, method) {
524529
let keydown = true;
525530
let splitKey = '+';
526531
let capture = false;
527-
let single = false; /** Allow only a single callback */
532+
/** Allow only a single callback */
533+
let single = false;
528534

529535
// Determine if the second argument is a function (no options provided)
530536
if (method === undefined && typeof option === 'function') {

dist/hotkeys.common.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/hotkeys.esm.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ const elementEventMap = new Map();
177177

178178
/** Return key code */
179179
const code = x => _keyMap[x.toLowerCase()] || _modifier[x.toLowerCase()] || x.toUpperCase().charCodeAt(0);
180+
const getKey = x => Object.keys(_keyMap).find(k => _keyMap[k] === x);
181+
const getModifier = x => Object.keys(_modifier).find(k => _modifier[k] === x);
180182

181183
/** Set or get the current scope (defaults to 'all') */
182184
function setScope(scope) {
@@ -190,6 +192,9 @@ function getScope() {
190192
function getPressedKeyCodes() {
191193
return _downKeys.slice(0);
192194
}
195+
function getPressedKeyString() {
196+
return _downKeys.map(c => getKey(c) || getModifier(c) || String.fromCharCode(c));
197+
}
193198
function getAllKeyCodes() {
194199
const result = [];
195200
Object.keys(_handlers).forEach(k => {
@@ -522,7 +527,8 @@ function hotkeys(key, option, method) {
522527
let keydown = true;
523528
let splitKey = '+';
524529
let capture = false;
525-
let single = false; /** Allow only a single callback */
530+
/** Allow only a single callback */
531+
let single = false;
526532

527533
// Determine if the second argument is a function (no options provided)
528534
if (method === undefined && typeof option === 'function') {

0 commit comments

Comments
 (0)