From b9cde08e0ef5f41a9b12821165c278c2944599ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=88=E8=BF=B7=E6=B4=A5=E6=B8=A1?= Date: Sat, 18 May 2019 20:03:02 +0800 Subject: [PATCH] fix: unbind keys issue (#82) --- dist/hotkeys.common.js | 7 ++++++- dist/hotkeys.common.min.js | 2 +- dist/hotkeys.esm.js | 7 ++++++- dist/hotkeys.js | 7 ++++++- dist/hotkeys.min.js | 2 +- src/main.js | 6 +++++- 6 files changed, 25 insertions(+), 6 deletions(-) diff --git a/dist/hotkeys.common.js b/dist/hotkeys.common.js index 43945dc..117a542 100644 --- a/dist/hotkeys.common.js +++ b/dist/hotkeys.common.js @@ -249,7 +249,12 @@ function unbind(key, scope, method) { // 将组合快捷键拆分为数组 keys = multipleKeys[i].split('+'); // 记录每个组合键中的修饰键的键码 返回数组 - if (keys.length > 1) mods = getMods(_modifier, keys); // 获取除修饰键外的键值key + if (keys.length > 1) { + mods = getMods(_modifier, keys); + } else { + mods = []; + } // 获取除修饰键外的键值key + key = keys[keys.length - 1]; key = key === '*' ? '*' : code(key); // 判断是否传入范围,没有就获取范围 diff --git a/dist/hotkeys.common.min.js b/dist/hotkeys.common.min.js index d1f6ec9..dee1a20 100644 --- a/dist/hotkeys.common.min.js +++ b/dist/hotkeys.common.min.js @@ -1,2 +1,2 @@ /*! hotkeys-js v3.6.8 | MIT (c) 2019 kenny wong | http://jaywcjlove.github.io/hotkeys */ -"use strict";var isff="undefined"!=typeof navigator&&0 1) mods = getMods(_modifier, keys); // 获取除修饰键外的键值key + if (keys.length > 1) { + mods = getMods(_modifier, keys); + } else { + mods = []; + } // 获取除修饰键外的键值key + key = keys[keys.length - 1]; key = key === '*' ? '*' : code(key); // 判断是否传入范围,没有就获取范围 diff --git a/dist/hotkeys.js b/dist/hotkeys.js index f11bbdf..6d091e9 100644 --- a/dist/hotkeys.js +++ b/dist/hotkeys.js @@ -253,7 +253,12 @@ // 将组合快捷键拆分为数组 keys = multipleKeys[i].split('+'); // 记录每个组合键中的修饰键的键码 返回数组 - if (keys.length > 1) mods = getMods(_modifier, keys); // 获取除修饰键外的键值key + if (keys.length > 1) { + mods = getMods(_modifier, keys); + } else { + mods = []; + } // 获取除修饰键外的键值key + key = keys[keys.length - 1]; key = key === '*' ? '*' : code(key); // 判断是否传入范围,没有就获取范围 diff --git a/dist/hotkeys.min.js b/dist/hotkeys.min.js index 6750fe7..ac0f51c 100644 --- a/dist/hotkeys.min.js +++ b/dist/hotkeys.min.js @@ -1,2 +1,2 @@ /*! hotkeys-js v3.6.8 | MIT (c) 2019 kenny wong | http://jaywcjlove.github.io/hotkeys */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0 1) mods = getMods(_modifier, keys); + if (keys.length > 1) { + mods = getMods(_modifier, keys); + } else { + mods = []; + } // 获取除修饰键外的键值key key = keys[keys.length - 1];