From 72d4d33e5a5fa2e401ffdebe61fce7c26fdfbd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A?= Date: Sat, 18 May 2019 18:35:44 +0800 Subject: [PATCH] fix: unbind keys --- 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 43945dc3..117a5424 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 d1f6ec96..dee1a200 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 f11bbdfe..6d091e90 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 6750fe75..ac0f51c1 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];