diff --git a/dist/hotkeys.common.js b/dist/hotkeys.common.js index ed95889..5eb4e33 100644 --- a/dist/hotkeys.common.js +++ b/dist/hotkeys.common.js @@ -2,7 +2,7 @@ * hotkeys-js v3.8.7 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * - * Copyright (c) 2021 kenny wong + * Copyright (c) 2022 kenny wong * http://jaywcjlove.github.io/hotkeys * * Licensed under the MIT license. @@ -308,15 +308,10 @@ var eachUnbind = function eachUnbind(_ref) { if (!scope) scope = getScope(); var mods = len > 1 ? getMods(_modifier, unbindKeys) : []; - _handlers[keyCode] = _handlers[keyCode].map(function (record) { + _handlers[keyCode] = _handlers[keyCode].filter(function (record) { // 通过函数判断,是否解除绑定,函数相等直接返回 var isMatchingMethod = method ? record.method === method : true; - - if (isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)) { - return {}; - } - - return record; + return !(isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)); }); }); }; // 对监听对应快捷键的回调函数进行处理 diff --git a/dist/hotkeys.common.min.js b/dist/hotkeys.common.min.js index 708f4f7..c6e9e29 100644 --- a/dist/hotkeys.common.min.js +++ b/dist/hotkeys.common.min.js @@ -1,2 +1,2 @@ -/*! hotkeys-js v3.8.7 | MIT (c) 2021 kenny wong | http://jaywcjlove.github.io/hotkeys */ -"use strict";var isff="undefined"!=typeof navigator&&0 | http://jaywcjlove.github.io/hotkeys */ +"use strict";var isff="undefined"!=typeof navigator&&0 + * Copyright (c) 2022 kenny wong * http://jaywcjlove.github.io/hotkeys * * Licensed under the MIT license. @@ -306,15 +306,10 @@ var eachUnbind = function eachUnbind(_ref) { if (!scope) scope = getScope(); var mods = len > 1 ? getMods(_modifier, unbindKeys) : []; - _handlers[keyCode] = _handlers[keyCode].map(function (record) { + _handlers[keyCode] = _handlers[keyCode].filter(function (record) { // 通过函数判断,是否解除绑定,函数相等直接返回 var isMatchingMethod = method ? record.method === method : true; - - if (isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)) { - return {}; - } - - return record; + return !(isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)); }); }); }; // 对监听对应快捷键的回调函数进行处理 @@ -569,4 +564,4 @@ if (typeof window !== 'undefined') { window.hotkeys = hotkeys; } -export default hotkeys; +export { hotkeys as default }; diff --git a/dist/hotkeys.js b/dist/hotkeys.js index d3d974c..5d43f43 100644 --- a/dist/hotkeys.js +++ b/dist/hotkeys.js @@ -2,7 +2,7 @@ * hotkeys-js v3.8.7 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * - * Copyright (c) 2021 kenny wong + * Copyright (c) 2022 kenny wong * http://jaywcjlove.github.io/hotkeys * * Licensed under the MIT license. @@ -12,7 +12,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.hotkeys = factory()); -}(this, (function () { 'use strict'; +})(this, (function () { 'use strict'; var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件 @@ -312,15 +312,10 @@ if (!scope) scope = getScope(); var mods = len > 1 ? getMods(_modifier, unbindKeys) : []; - _handlers[keyCode] = _handlers[keyCode].map(function (record) { + _handlers[keyCode] = _handlers[keyCode].filter(function (record) { // 通过函数判断,是否解除绑定,函数相等直接返回 var isMatchingMethod = method ? record.method === method : true; - - if (isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)) { - return {}; - } - - return record; + return !(isMatchingMethod && record.scope === scope && compareArray(record.mods, mods)); }); }); }; // 对监听对应快捷键的回调函数进行处理 @@ -577,4 +572,4 @@ return hotkeys; -}))); +})); diff --git a/dist/hotkeys.min.js b/dist/hotkeys.min.js index 4453fe2..507448e 100644 --- a/dist/hotkeys.min.js +++ b/dist/hotkeys.min.js @@ -1,2 +1,2 @@ -/*! hotkeys-js v3.8.7 | MIT (c) 2021 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="undefined"!=typeof globalThis?globalThis:e||self).hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0 | 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="undefined"!=typeof globalThis?globalThis:e||self).hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0 1 ? getMods(_modifier, unbindKeys) : []; - _handlers[keyCode] = _handlers[keyCode].map((record) => { + _handlers[keyCode] = _handlers[keyCode].filter((record) => { // 通过函数判断,是否解除绑定,函数相等直接返回 const isMatchingMethod = method ? record.method === method : true; - if ( + return !( isMatchingMethod && record.scope === scope && compareArray(record.mods, mods) - ) { - return {}; - } - return record; + ); }); }); };