released v3.8.8

pull/350/head v3.8.8
jaywcjlove 3 years ago
parent b6ad954bab
commit bced4043e8

@ -1,11 +1,10 @@
/*! /**!
* hotkeys-js v3.8.7 * hotkeys-js v3.8.8
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
* *
* Copyright (c) 2022 kenny wong <wowohoo@qq.com> * Copyright (c) 2022 kenny wong <wowohoo@qq.com>
* http://jaywcjlove.github.io/hotkeys * http://jaywcjlove.github.io/hotkeys
* * Licensed under the MIT license
* Licensed under the MIT license.
*/ */
'use strict'; 'use strict';
@ -157,6 +156,8 @@ for (var k = 1; k < 20; k++) {
var _downKeys = []; // 记录摁下的绑定键 var _downKeys = []; // 记录摁下的绑定键
var winListendFocus = false; // window是否已经监听了focus事件
var _scope = 'all'; // 默认热键范围 var _scope = 'all'; // 默认热键范围
var elementHasBindEvent = []; // 已绑定事件的节点记录 var elementHasBindEvent = []; // 已绑定事件的节点记录
@ -526,9 +527,14 @@ function hotkeys(key, option, method) {
addEvent(element, 'keydown', function (e) { addEvent(element, 'keydown', function (e) {
dispatch(e); dispatch(e);
}); });
addEvent(window, 'focus', function () {
_downKeys = []; if (!winListendFocus) {
}); winListendFocus = true;
addEvent(window, 'focus', function () {
_downKeys = [];
});
}
addEvent(element, 'keyup', function (e) { addEvent(element, 'keyup', function (e) {
dispatch(e); dispatch(e);
clearModifier(e); clearModifier(e);

File diff suppressed because one or more lines are too long

@ -1,11 +1,10 @@
/*! /**!
* hotkeys-js v3.8.7 * hotkeys-js v3.8.8
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
* *
* Copyright (c) 2022 kenny wong <wowohoo@qq.com> * Copyright (c) 2022 kenny wong <wowohoo@qq.com>
* http://jaywcjlove.github.io/hotkeys * http://jaywcjlove.github.io/hotkeys
* * Licensed under the MIT license
* Licensed under the MIT license.
*/ */
var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件 var isff = typeof navigator !== 'undefined' ? navigator.userAgent.toLowerCase().indexOf('firefox') > 0 : false; // 绑定事件
@ -155,6 +154,8 @@ for (var k = 1; k < 20; k++) {
var _downKeys = []; // 记录摁下的绑定键 var _downKeys = []; // 记录摁下的绑定键
var winListendFocus = false; // window是否已经监听了focus事件
var _scope = 'all'; // 默认热键范围 var _scope = 'all'; // 默认热键范围
var elementHasBindEvent = []; // 已绑定事件的节点记录 var elementHasBindEvent = []; // 已绑定事件的节点记录
@ -524,9 +525,14 @@ function hotkeys(key, option, method) {
addEvent(element, 'keydown', function (e) { addEvent(element, 'keydown', function (e) {
dispatch(e); dispatch(e);
}); });
addEvent(window, 'focus', function () {
_downKeys = []; if (!winListendFocus) {
}); winListendFocus = true;
addEvent(window, 'focus', function () {
_downKeys = [];
});
}
addEvent(element, 'keyup', function (e) { addEvent(element, 'keyup', function (e) {
dispatch(e); dispatch(e);
clearModifier(e); clearModifier(e);

26
dist/hotkeys.js vendored

@ -1,11 +1,10 @@
/*! /**!
* hotkeys-js v3.8.7 * hotkeys-js v3.8.8
* A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.
* *
* Copyright (c) 2022 kenny wong <wowohoo@qq.com> * Copyright (c) 2022 kenny wong <wowohoo@qq.com>
* http://jaywcjlove.github.io/hotkeys * http://jaywcjlove.github.io/hotkeys
* * Licensed under the MIT license
* Licensed under the MIT license.
*/ */
(function (global, factory) { (function (global, factory) {
@ -161,6 +160,8 @@
var _downKeys = []; // 记录摁下的绑定键 var _downKeys = []; // 记录摁下的绑定键
var winListendFocus = false; // window是否已经监听了focus事件
var _scope = 'all'; // 默认热键范围 var _scope = 'all'; // 默认热键范围
var elementHasBindEvent = []; // 已绑定事件的节点记录 var elementHasBindEvent = []; // 已绑定事件的节点记录
@ -530,9 +531,14 @@
addEvent(element, 'keydown', function (e) { addEvent(element, 'keydown', function (e) {
dispatch(e); dispatch(e);
}); });
addEvent(window, 'focus', function () {
_downKeys = []; if (!winListendFocus) {
}); winListendFocus = true;
addEvent(window, 'focus', function () {
_downKeys = [];
});
}
addEvent(element, 'keyup', function (e) { addEvent(element, 'keyup', function (e) {
dispatch(e); dispatch(e);
clearModifier(e); clearModifier(e);

File diff suppressed because one or more lines are too long

4
package-lock.json generated

@ -1,12 +1,12 @@
{ {
"name": "hotkeys-js", "name": "hotkeys-js",
"version": "3.8.7", "version": "3.8.8",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "hotkeys-js", "name": "hotkeys-js",
"version": "3.8.7", "version": "3.8.8",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "~7.17.0", "@babel/eslint-parser": "~7.17.0",

@ -1,7 +1,7 @@
{ {
"name": "hotkeys-js", "name": "hotkeys-js",
"description": "A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.", "description": "A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.",
"version": "3.8.7", "version": "3.8.8",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"module": "dist/hotkeys.esm.js", "module": "dist/hotkeys.esm.js",

Loading…
Cancel
Save