diff --git a/dist/hotkeys.common.js b/dist/hotkeys.common.js index 97a5462..4aa2288 100644 --- a/dist/hotkeys.common.js +++ b/dist/hotkeys.common.js @@ -1,5 +1,5 @@ /*! - * hotkeys-js v3.5.0 + * hotkeys-js v3.5.1 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * * Copyright (c) 2019 kenny wong @@ -318,7 +318,7 @@ function dispatch(event) { // 对任何快捷键都需要做的处理 if (asterisk) { for (var i = 0; i < asterisk.length; i++) { - if (asterisk[i].scope === scope && (event.type === 'keydown' || event.type === 'keyup' && asterisk[i].keyup)) { + if (asterisk[i].scope === scope && (event.type === 'keydown' && !asterisk[i].keyup || event.type === 'keyup' && asterisk[i].keyup)) { eventHandler(event, asterisk[i], scope); } } @@ -327,8 +327,10 @@ function dispatch(event) { if (!(key in _handlers)) return; for (var _i = 0; _i < _handlers[key].length; _i++) { - // 找到处理内容 - eventHandler(event, _handlers[key][_i], scope); + if (event.type === 'keydown' && !_handlers[key][_i].keyup || event.type === 'keyup' && _handlers[key][_i].keyup) { + // 找到处理内容 + eventHandler(event, _handlers[key][_i], scope); + } } } @@ -366,7 +368,7 @@ function hotkeys(key, option, method) { // 判断key是否在_handlers中,不在就赋一个空数组 if (!(key in _handlers)) _handlers[key] = []; _handlers[key].push({ - keyup: option.keyup || false, + keyup: option.keyup, scope: scope, mods: mods, shortcut: keys[i], diff --git a/dist/hotkeys.common.min.js b/dist/hotkeys.common.min.js index 8cc4881..32ab4c2 100644 --- a/dist/hotkeys.common.min.js +++ b/dist/hotkeys.common.min.js @@ -1,2 +1,2 @@ -/*! hotkeys-js v3.5.0 | MIT (c) 2019 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 @@ -316,7 +316,7 @@ function dispatch(event) { // 对任何快捷键都需要做的处理 if (asterisk) { for (var i = 0; i < asterisk.length; i++) { - if (asterisk[i].scope === scope && (event.type === 'keydown' || event.type === 'keyup' && asterisk[i].keyup)) { + if (asterisk[i].scope === scope && (event.type === 'keydown' && !asterisk[i].keyup || event.type === 'keyup' && asterisk[i].keyup)) { eventHandler(event, asterisk[i], scope); } } @@ -325,8 +325,10 @@ function dispatch(event) { if (!(key in _handlers)) return; for (var _i = 0; _i < _handlers[key].length; _i++) { - // 找到处理内容 - eventHandler(event, _handlers[key][_i], scope); + if (event.type === 'keydown' && !_handlers[key][_i].keyup || event.type === 'keyup' && _handlers[key][_i].keyup) { + // 找到处理内容 + eventHandler(event, _handlers[key][_i], scope); + } } } @@ -364,7 +366,7 @@ function hotkeys(key, option, method) { // 判断key是否在_handlers中,不在就赋一个空数组 if (!(key in _handlers)) _handlers[key] = []; _handlers[key].push({ - keyup: option.keyup || false, + keyup: option.keyup, scope: scope, mods: mods, shortcut: keys[i], diff --git a/dist/hotkeys.js b/dist/hotkeys.js index d830be0..63068d5 100644 --- a/dist/hotkeys.js +++ b/dist/hotkeys.js @@ -1,5 +1,5 @@ /*! - * hotkeys-js v3.5.0 + * hotkeys-js v3.5.1 * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * * Copyright (c) 2019 kenny wong @@ -322,7 +322,7 @@ // 对任何快捷键都需要做的处理 if (asterisk) { for (var i = 0; i < asterisk.length; i++) { - if (asterisk[i].scope === scope && (event.type === 'keydown' || event.type === 'keyup' && asterisk[i].keyup)) { + if (asterisk[i].scope === scope && (event.type === 'keydown' && !asterisk[i].keyup || event.type === 'keyup' && asterisk[i].keyup)) { eventHandler(event, asterisk[i], scope); } } @@ -331,8 +331,10 @@ if (!(key in _handlers)) return; for (var _i = 0; _i < _handlers[key].length; _i++) { - // 找到处理内容 - eventHandler(event, _handlers[key][_i], scope); + if (event.type === 'keydown' && !_handlers[key][_i].keyup || event.type === 'keyup' && _handlers[key][_i].keyup) { + // 找到处理内容 + eventHandler(event, _handlers[key][_i], scope); + } } } @@ -370,7 +372,7 @@ // 判断key是否在_handlers中,不在就赋一个空数组 if (!(key in _handlers)) _handlers[key] = []; _handlers[key].push({ - keyup: option.keyup || false, + keyup: option.keyup, scope: scope, mods: mods, shortcut: keys[i], diff --git a/dist/hotkeys.min.js b/dist/hotkeys.min.js index 05e6db9..1a5a434 100644 --- a/dist/hotkeys.min.js +++ b/dist/hotkeys.min.js @@ -1,2 +1,2 @@ -/*! hotkeys-js v3.5.0 | 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.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.hotkeys=t()}(this,function(){"use strict";var e="undefined"!=typeof navigator&&0